- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
The C++ Standard explicitly prohibits integer types from having a representation for infinity.
Admin
I think you'll find that's about 100k.
Filed under: Off by 10 error
Admin
Flagged for pendantry.
Admin
Umm, yeah. Hanzo'd.
Still, it's not like it ought to take very long. 3½ minutes is criminal. What are they doing, using linear searches of a linked list for template matching?
Admin
Foreach loop that runs once?
Admin
They probably assume that programmers aren't doing what you're trying to do here, which is a pretty reasonable assumption. If you try to break the compiler, you get to put up with the results.
Admin
:smiley:
Admin
I wonder if it's something like:
Admin
Finally got some time to do some testing.
The results are as expected: the code compiles without any warning (
g++ -Wall -Wextra
), without optimizations it segfaults, with optimizations we get infinite loop. For unsigned char, it takes a fraction of second to compile. For unsigned short, nonoptimized compilation takes 70 seconds, optimized takes 43 seconds. Binary sizes are as follows:I don't know how, but I was sure I sent this post yesterday... But apparently I didn't. But it got saved in the cumulonimbus and now, on another computer, I still have a complete text I've written. Discourse having useful feature? TRWTF right here.