Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@phnt @ElDeadKennedy @Junes @SilverDeth @ceo_of_monoeye_dating @j @lanodan
> Some embedded stuff probably fails on it
A lot of embedded stuff fails on a lot of weird cases and usually the answer is "Don't do stupid shit, X3J11 can't help you here. Patch it out or don't." That's a reasonable answer where you're counting bytes. But I'm sure I've seen it somewhere besides embedded libraries.
> But even Microsoft implemented that correctly, which is unusual for them
Well, "to spec" rather than "correctly". Edge-case behavior is "What should you have a reason to expect?" rather than "What's the best thing to do in this case?" A *good* spec is more descriptive than prescriptive, but "Well, that's not defined, what if someone digs up a one's complement machine and then tries to port your code to it? Huh? HUH?!" The reason integer overflow isn't defined is to give implementers space to do things: you can't have guards around every increment so while there were one's complement machines, you couldn't rely on that behavior. gcc's current behavior has the tail wagging the dog: "You can't possibly know that `for(int i=1;i;i++);` will ever terminate!" is pants-on-head retarded.
Rant aside, I mean, you generally don't want to rely on Microsoft to do what every sane implementer does.