Quote:Original post by rip-off
Quote:Original post by Sharlin
Quote:Original post by Washu
Still not standard. They might be adopted into 0x, but I haven't seen much forward movement on that front.
Sure they are; jpetrie already quoted the relevant chapter and verse.
"Implementation defined" is not much of a standard. Might as well be undefined behaviour altogether.
Not at all.
Undefined behavior is completely unreliable. If your program has UB then it is a complete and utter bug. However, implementation defined behavior is always reliable on a given system.
Most classes in the STL have implementation defined types for their iterator members and related type definitions and differences.
The size of nearly all data types is implementation defined with a specific minimum. That was already briefly mentioned because an unsigned int isn't guaranteed to hold at least 32 bits, but an unsigned long will hold at least that much.
Many conversions, including mappings performed by reinterpret_cast<>, are implementation defined.
We can rely on these implementation defined behaviors, and people who develop cross-platform games (like me) rely heavily on knowing what is IB and making sure it is handled consistently between platforms.
Other things are a little more tricky, such as alignment, byte ordering, and structure padding. They are all implementation defined, but a little harder to take advantage of.
Yes you are right that the use of multibyte characters is implementation defined. They are treated as int, and when converted to an unsigned long, are properly handled on all systems (although re-ordered for proper byte ordering). But that is
not the same as undefined.
Relying on implementation-defined behavior is a good thing. It lets us know that we can reliably run on any processor, from a Z80 to an Arm9 to a dual OpteronX64. It means our game core will work fine if we port it from the X360 to the Wii to a PSP or DS, or even jump over to Windows Mobile.
Relying on undefined behavior is guaranteed catastrophic behavior for the 'real' world. Please don't confuse the two.