top | item 15327870

(no title)

belovedeagle | 8 years ago

Nothing in the C standard prohibits parts of the executable from (a) being outside the "program" and thus many of the limitations of the standard, and (b) running before main. Therefore on Linux and Windows and almost certainly OS X too, main is not called first. Anyone who knows anything about systems programming knows this or should. (See also: the 90 million My First Disassembly blog posts out there.)

But you know what else the c standard says? UB is UB. People in here complaining that UB is really unfair because it forces them to write correct programs are the ones bringing the real world into scope in this discussion. If you want to insist that we limit the discussion to the standard then you're just objectively wrong by definition, end of discussion. I was trying to be more productive than that.

discuss

order

No comments yet.