Is it legal/well-defined C++ to call a non-static method that doesn’t access members through a null pointer?

This will probably work on most systems, but it is Undefined Behaviour. Quoth the Standard: 5.2.5.3 If E1 has the type “pointer to class X,” then the expression E1->E2 is converted to the equivalent form (*(E1)).E2 […] And: 5.2.5.1 A postfix expression followed by a dot . or an arrow ->, optionally followed by the … Read more

Can I legally reinterpret_cast between layout-compatible standard-layout types?

but I can’t see anything in the standard that therefore allows me to reinterpret_cast between them, even though that seems like the reasonable interpretation of “value representation”. Is this technically allowed by the standard? No. The standard is clear (see [basic.lval] p10) about which types can be aliased, and layout-compatible types are not included. If … Read more

Denormalized Numbers – IEEE 754 Floating Point

Essentially, a denormalized float has the ability to represent the SMALLEST (in magnitude) number that is possible to be represented with any floating point value. That is correct. using denormalized numbers comes with a performance cost on many platforms The penalty is different on different processors, but it can be up to 2 orders of … Read more

What could C/C++ “lose” if they defined a standard ABI?

The freedom to implement things in the most natural way on each processor. I imagine that c in particular has conforming implementations on more different architectures than any other language. Abiding by a ABI optimized for the currently common, high-end, general-purpose CPUs would require unnatural contortions on some the odder machines out there.

Is auto_ptr deprecated?

UPDATE: This answer was written in 2010 and as anticipated std::auto_ptr has been deprecated. The advice is entirely valid. In C++0x std::auto_ptr will be deprecated in favor of std::unique_ptr. The choice of smart pointer will depend on your use case and your requirements, with std::unique_ptr with move semantics for single ownership that can be used … Read more