- 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
Admin
Did I just read this article on TDWTF?
... I am losing faith...
Admin
That sounds familiar…
EDIT: replacing one _ with %5F in the href so Discourse doesn’t replace my valid link with an invalid one.
Admin
Result from first link: [image]
TheDailyWTF now has it's own "error while displaying the error" Error'd.
Also: WHAT! Thats literally the same WTF!
Admin
Admin
@VinDuv - Days Since Last Discourse Bug: 0
<!-- Posted by SockBot 0.13.0 "Devious Daine" on Mon Nov 03 2014 06:30:14 GMT+0000 (UTC)-->Admin
Wow. I am truly impressed by your searching skills / memory.
Oh look, @Remy wrote a comment about all this:
That's why you put E-Mails that have been successfully worked on into a separate folder!
Admin
Thanks. I tend to only remember completely useless things, though... (at least looking for “Deulish” was easy enough)
Admin
FTFY.
Yes, I know you're a bot.
No, I don't care.
Admin
Admin
So the original was in C# and this one is in Java. I can just see it now. "Well, this is how I wrote it while working for another company. I can do the same here, but in Java this time."
Admin
Java? Java uses
String
s. Notstring
s.Admin
Let's count the WTFs, shall we?
Admin
The second was a "Classic WTF" article. Doesn't count.
Admin
Apparently the server does not see fit to preview the comments.
[image]Admin
Very odd, it used to work earlier.
The Frontpage is no longer worthy of Discourse's comments.
Admin
Yes it does. He gets two links to read how not to do it.
Yes, TDWTF is mandatory reading for any professional :)
Admin
TRWTF is 12 space indents.
Admin
Hey, at least this structure is infinitely extensible!
if ( turtle) { if ( turtle) { if ( turtle) { if ( turtle) { ... ... ... return (allthewaydown.txt) } ... ... } } }
Admin
:facepalm:
just.... just :facepalm:
Admin
Admin
Hey now, that was funny.
Admin
Hmm, only happens when I copy-paste. Apparently using the Quote tool "works just fine". :white_check_mark:
Admin
You gave up after finite tries?
while (turtle); return (notallthewaydown.txt);
Admin
hmmm......
Admin
Wouldn't it be more appropriate to use the "minutes" unit? Or even seconds?
Admin
Filed under: If C macros were recursive, it would be not only infinite buttembly but also infinite source file
Admin
Wait. If I understand C++ templates.... that won't finish compiling.
Because it has to make an instance of the function for every possible content of the <>.
Admin
that is a malformed template, sure.
it won't complete compiling successfully ever, but it may eventually complete with error.
Admin
Actually, assuming you're not targetting abstract Turing machine, I think it should stop at 4294967296th specialization, which shouldn't be outside of today's computers reach. Can't test right now though.
Also, I would nominate you two for not getting the joke badge if I knew how.
Admin
flag as notify moderators and mention the badge you are flagging for.
of course there's the possiblility we got the joke and decided to play along rather than calling you out on it. :smiley: i know that's what i was doing (although the mods might disagree)
Admin
Admin
maybe. like i said the mods might disagree with my assertion that i got the joke.
Admin
Even 99,999 takes bloody ages though. Not going to even try deeper:
Naïevely extrapolating1 suggests at least 3+ months to (fail to) compile 4294967296.
1 https://www.google.co.uk/search?q=(4294967296%2F99999*3)+minutes+in+days
Admin
No wonder it takes so long. If no inlining would be done, the executable would be in tens of gigabytes. Still, gonna do some more testing tomorrow. On short int.
Admin
short unsigned int
. The signedness means technically, instantiating your template causes UB. Probably would come out working the way you expect, but usingunsigned
will make sure.Admin
On x86, it is de facto implementation-defined rather than undefined - and implementations define it as "treat signed overflow the same as unsigned overflow".
Admin
That's probably true during template instantation, but considering what goes on in optimization with normal code (where it is most definitely not treated as defined, wraparound behavior) I don't see why you'd pick the one with actually-defined behavior when it doesn't really have any downsides for your experiment. Sort of a "I type
++i
for iterators because maybe, in some cases, the optimizer will be dumb even though it probably won't" kind of thing.Admin
I'd be very surprised if it didn't come out working the way I expect...
I'd fully expect it to not get as far as compiling, and I'd be very surprised at any other outcome...
Admin
Anyway, the reason why I wrote
Why? The code is valid C++. The only reason why it doesn't compile is because of compiler limitations. It will overflow stack and crash at runtime, however - but that's too just platform limitations and not because of invalid code.short int
and notunsigned short int
is because it was 1AM.Admin
Really?
Let me know which section of the C++ standard allows for ∞ to be stored in an int, and I may concede the point.
Admin
doesn't it only specify the minimum size for an int? No maximum, therefore ℵ0 is an acceptable value
Admin
[lib.numeric.limits] describes
has_infinity
and indicates that it is true only for floating point types (and the only other specialisation given is for bool, for which it is, obviously, FILE_NOT_FOUND.)Admin
I stand corrected. Luckily, I've never had to delve too deep into the inner workings of C++
Admin
The Standard's aren't exactly riveting reading....
Admin
Admin
limits.h is only valid for the architecture it's compiling for. there are different values for 32, 64 and 128 bit compilers (yes we do have a few 128 bit processors. they cost as much as a vintage mustang in mint condition but they do exist)
so one could expand that to a thoretical infinite bit computer....
of course we probably couldn't build the sucker, but we can theorize about it and, more importantly, implement a C compiler for it.
Admin
You don't have to theorize for it.
You just have to reserve a value to represent infinity, then create the rules for how it interacts with other values.
infinity +/- (finite int value) = infinity.
http://msdn.microsoft.com/en-us/library/system.double.positiveinfinity(v=vs.110).aspx
Admin
floating point numbers make provisions for non number values in their ISO spec. integers don't. they are simply numbers stored as 2's compliment values (for signed numbers) there is no "not a finite number" value there.
i can look up chapter and verse if you want, but it's lunch hours. i'd much rather work on sockbot.
Admin
Nearly 3 and a half minutes to count to about 100k? That's a crappy scripting language there. Why not switch to something faster? Like Ruby… ;-)