So... C++14 is done :O

Started by
84 comments, last by BitMaster 9 years, 7 months ago

I have to agree with SmkViper and disagree with Samoth. No compiler will actively insert a formatHardDrive() but all you need is to call an uninitialized function pointer. The address just has accidentally match the address where the corresponding OS function is mapped to. Your call stack might look just right. Likely? Nope. Extremely unlikely? Yes. But still theoretically possible? Yep.

I actually have personal experience with something a bit like that. Sometime in 97/98/99 when I was young and learning and inexperienced I was crashing my DirectX applications with undefined behavior. At some point I couldn't get anything to work even when reverting to a known workable state. I decided to call it a night and try it fresh again tomorrow. Long story short, after banging my head against a couple of walls I noticed several DirectX DLLs had a rather peculiar size: 0 bytes. And I wasn't even doing anything with file IO.

Granted, something like that is unlikely to happen on modern operating systems, but a surprising amount of crap can/could still happen with undefined behavior.

And even setting all of that aside, the "could format your hard drive"-story is mostly hyperbole to catch attention. A lot of people coming here with undefined behavior problems don't recognize what kind of problem they are in and then post something like "I just switch those two variable declarations and the problem went away. Thanks guys." and then complain when people don't stop talking about their (still existing, just currently hidden) issue.

This topic is closed to new replies.

Advertisement