- "Address Sanitizer in Visual C++" by Shao Voon Wong - 4 Updates
- Call destructor on object of any type - 5 Updates
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Aug 10 10:09PM -0700 On 8/10/2020 2:32 PM, Lynn McGuire wrote: > ASan to the Windows platform in 2019 and since it is still at an > experimental stage, be sure to expect kinks to be ironed out." > I wonder how much it slows down your software. Have you every used Relacy? |
Lynn McGuire <lynnmcguire5@gmail.com>: Aug 11 12:44PM -0500 On 8/11/2020 12:09 AM, Chris M. Thomasson wrote: >> at an experimental stage, be sure to expect kinks to be ironed out." >> I wonder how much it slows down your software. > Have you every used Relacy? No. The only memory checking tool that I have used in C / C++ was Purify on Sun Workstations back in the 1990s. It dragged our software down horribly and made our software unusable with it on. But it helped immensely. Thanks, Lynn |
Bonita Montero <Bonita.Montero@gmail.com>: Aug 11 07:48PM +0200 >> at an experimental stage, be sure to expect kinks to be ironed out." >> I wonder how much it slows down your software. > Have you every used Relacy? Relacy isn't the same as the above Address Sanitizer. |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Aug 11 01:07PM -0700 On 8/11/2020 10:48 AM, Bonita Montero wrote: >>> I wonder how much it slows down your software. >> Have you every used Relacy? > Relacy isn't the same as the above Address Sanitizer. I know. Also, fwiw, I am friends with the guy who created both of them. Relacy and Address Sanitizer. We had the best conversations way back on comp.programming.threads. Back when it was not a spam infested nightmare. Thanks to animer... ramine the plague! |
Paavo Helde <eesnimi@osa.pri.ee>: Aug 11 09:28AM +0300 10.08.2020 10:36 Frederick Gotham kirjutas: > ^ > other.cpp:8:84: error: expected '(' before ')' token > obj.~(typename std::remove_cv<std::remove_reference<decltype(obj)>::type>::type)(); The standard says: "In an explicit destructor call, the destructor is specified by a ~ followed by a type-name or decltype-specifier that denotes the destructor's class type." Type-name is defined as a class-name, enum-name or typedef-name. Decltype-specifier would have a form decltype(...). Your example does not conform to any of these variants, that's why the compiler complains. As to why the standard does not allow for more elaborate syntax at this point I can only guess that this is because ~ already has another meaning inherited from C (bitwise complement operator) and they did not want to muddy the waters any more. But if so, why then allow decltype-specifier which is also quite elaborate? (To be honest, decltype-specifier seems to be not supported in this context by most C++ compilers.) |
Frederick Gotham <cauldwell.thomas@gmail.com>: Aug 11 03:39AM -0700 On Tuesday, August 11, 2020 at 7:29:10 AM UTC+1, Paavo Helde wrote: > decltype-specifier which is also quite elaborate? (To be honest, > decltype-specifier seems to be not supported in this context by most C++ > compilers.) The following fails to compile with the GNU g++ compiler: class Dog {}; int main(void) { Dog obj; obj.~decltype(obj)(); } |
Bo Persson <bo@bo-persson.se>: Aug 11 01:59PM +0200 On 2020-08-11 at 12:39, Frederick Gotham wrote: > Dog obj; > obj.~decltype(obj)(); > } On the other hand, this does compile: #include <memory> class Dog {}; int main(void) { Dog obj; std::destroy_at(&obj); } |
Juha Nieminen <nospam@thanks.invalid>: Aug 11 12:04PM > Let's say there's an object called "obj", and we don't know its type. We can call its destructor as follows: I can't think of any situation where you would have an object without knowing its type (even if it's a templated type, it's still a named type which you can use for this). Which situation do you envision happening in? Well, I suppose in C++20 you can write void test(auto& obj) { ... } If anything else fails, you can always implement a helper template: template<typename T> void destroy(T& obj) { obj.~T(); } |
Frederick Gotham <cauldwell.thomas@gmail.com>: Aug 11 05:37AM -0700 On Tuesday, August 11, 2020 at 1:04:55 PM UTC+1, Juha Nieminen wrote: > { > obj.~T(); > } I wanted to come up with a one-liner, but the closest I came to it was two lines: typedef decltype(obj) T; obj.~T(); In theory the following should work (i.e. it's allowed by the Standard), but I don't think any compiler allows it: obj.~delctype(obj)(); |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment