- 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
Perhaps the real WTF is blogs where you can't edit your posts to correct glaring errors.
But it is not really used to fix or assign in mathematics, it is more used as an observation. Mathematics is not a programming language after all. It usually goes more like
if x=5 and y=10 then xy = 510 = 50. The mathematic is timeless and in this example, x will always be 5 but a program runs through steps and x may be changed at any time.
I think my old Casio calculator had it more correct. Assignment was represented by little arrows to represent putting the value into the variable.
Rich
Admin
That doesn't match the semantics of the original. What if b is NOT equal to b, what then? The code given leaves it unchanged; yours sets it to false. better would be 'b = (b == b ? true : b);'
Admin
> No, it used the assignment (=) and not the comparison (==)
No, it says "end if" afterwards. It's not C or C++ or C# or Java or PHP or Perl, but BASIC in which the comparison operator is actually = rather than ==.
Admin
{ b = (b == b) || break }
I can't remember if you're allowed to use break inside expressions in C, nor if plain braces are break()ed to. So, safe version ("
({...})
" is a GCC extension, IIRC, allowing statements inside an expression):b = (b == b) || ({goto OR_NOT}) }; OR_NOT: (void)NULL;
blah... this is so much nicer in perl. I've even done something similar a few times:
"
ERROR: { die problem1() ? "error 1" : problem2() ? "error 2" : ... : last ERROR }
Admin
Oh, I've written uglier lines than that!
Admin
long live the codesmorgasboard.
I like this one;
It reminds me of a code review I once did. the code review policy at our company stated that "thou shall not use magic numbers in code. They are unreadable to new eyes and hinder maintenance"
So after pointing out a few of them
init_interupt($A355, $B643)
I had to smile when getting the code back to review a second time:
Admin
1000 GOTO 1002
1001 GOTO 1010
1002 GOTO 1001
This is not three lefts, its three wrongs.
Admin
if b = b then
b = true
end if
In a dynamically-typed language where '=' is not assignment in an if statement, this could be a useful body of "bool isValidNumber( b)" (for any NaN n, we have !(n==n)).
#define SIZE_2048 2048
struct disk_request (
...
BYTE buffer[SIZE_2048]; /* data buffer 1024 bytes long */
};
This could be correct on a 4-bit system with a non-standard C compiler where chars are 4 bits :-)
Admin
Are any other Perl coders reading this and saying "so that's how you copy one hash into another?" I've never been able to grasp the syntax of list-assignments with anything beyond trivial lists of scalars on the left side.
Admin
The best are:
Admin
I just spent like 5 minutes trying to figure out what was going wrong with this one thing. Here, I'll reproduce (paraphrase) the symptoms:
% ls
.... wf1.c
% cat wfl.c
wfl.c: file not found
% cat w<TAB for autocomplete>f1.c
.... (no error)
% ls wfl.c
%
Stupid ssh program I was using uses a font that makes 1 ("one") and l ("lowercase L") nearly indistinguishable...
Admin
Unless I'm mistaken, 360 day years are used in some financial circles.
Ayup:
http://en.wikipedia.org/wiki/360_day_calendar
(Edit: Yeah and I'm like bazillionth person to point this out. Sorry. Just pointing out that some people had to learn about this WTF back in high school. =)
Admin
Admin
and to think people used to get paid to do this :(
Admin
There is no such thing as an int(eger) data type in Javascript. Also, Javascript doesn't know casting and especially not this C-style syntax. The above code will simply produce a syntax error.
Admin
This is obviously a BASIC way of implementing a sort of NOP.. perhaps a (very short) pause between 2 different notes of music or whatever to make a more lasery sound in a game (worked like a charm on my old p3105)
Admin
no no no! That was
FOR i = 0 TO 10000
END FOR
Admin
($foo, $bar[2], $bar[3], $bar[4], $baz)
($foo, @bar[2 .. 4], $baz)
as are these:
($foo, $bar{eek}, $bar{ack}, $bar{ook}, $baz)
($foo, @bar{qw(eek ack ook)}, $baz)
This is true whether they're being assigned to or otherwise. However, if you put a complete array or hash on the LHS of an assignment, it will take up as much as it can from the RHS, and everything asfter it on the LHS will end up as
undef
:($foo, @bar, $baz) = something(); # $baz = undef, always
clear as mud?
Admin
Awesome...I predict "muhahahah" is going to be a new TDWTF inside joke like Paula Bean and woodent tables. I already wrote muhahaha.h to include in all my projects. Cheers
Admin
Now, that's true enough but why not go one step further to make it just that little bit more interesting?:<p>
b = ( b==b ? b==b : b );
<p>
Rich
Admin
wtf? Earlier I relied on carriage returns in the input box to create paragraphs and it ended up joining my name to the end of my comment (whitespace), this time I put in HTML and it htmlescaped it...
Rich
Admin
And then it just did it again. I suspect different mechanisms for reply and quote?
Rich
Admin
OK, I give up
Rich
Admin
I'd bet that the compiler would effectively take these out, anyway. This person may be the laziest programmer alive. ;)
Admin
I'm laughing. No matter what = is doing here, I see no reason to do it to one variable like this. If it is a conditional operator, you would never check to make sure that the value in b is in fact the value in b, and if you are counting on strange proprietary compiler behavior it is still a terrible peice of code. If the = is an assignment operator, nothing would still be accomplished. And one last case, if = is redefined somehow for any other operation, it is still too misleading.
Admin
Different strokes for different folks...I always liked := from Pascal for assignment.
Admin
on those times where BASIC-instructions where preceeded by line numbers, the compilers couldn't do anything more fanzy than a literal translation of source code to machine code.
It's ok to read, but I find it to be a pain to type, at least on the german keyboard layout I'm used to.
Admin
360 days in a year? Guess its not a unique idea.
http://google.com/codesearch?hl=en&lr=&q=%22360+days+in+a+year%22&btnG=Search
Admin
We need more information to conclude that something is wrong.
For example, we don't know what the data type of b is: if b can be "null", then (except in a few strange Microsoft worlds), b = b will return false.
To even claim this much, I'm making assumptions about the nature of "=". Like I said at the beginning, we need more information before we can start laughing at this one.
<joke>Is it possible that there was an operator override function for "=" and it assigns not equal of b to b? If that is the case this is even bigger WTF.</joke>
Admin
Well, no, because it'd still be 2048 bytes, just 2048 4-bit bytes. 1024 octets, I'll grant you, and most people think octet and byte are synonymous.
(Actually, no variety of C could go as far down in character size as 4 bits. I think 6 bits was the absolute minimum.)
Admin
Pardon me but last time I checked disk sector buffers were still measured in BYTES. Since the buffer of 1024 bytes is less common, I presume that the comment is stale and that the size of 2048 is there because of say sector size on a CD.
Another thing is that whoever wrote that hasn't used const int instead of #define.
Admin
That is right.
This is because it was too difficult to do calculation with 365.. The winner is the lender i.e. usually banks.
Admin
Is this the routine of Deep Thought?... I'm disappointed.
Admin
<font face="tahoma,arial,helvetica,sans-serif">I think Deep Thought has sleep() on the first line...
</font>
Admin
It's also correct for negative numbers (with the parentheses), if you take the frequently-used convention of rounding 0.5 to the next bigger whole number. The java Math.round function is implemented in the same way as the WTF. (That may just reinforce some ppls preconceptions about Java, but wtf..)
Admin
The question "Is Nan double-D?" can only be answered by a careful measurement of Nan's, er, size.
Admin
360 day a year?
Must be METRIC :)
Admin
Well, I suppose the issue with if b=b could have been some procedural extention to SQL.
If that was the case and b was NULL, then b=b would not return true and b would not be set to true.
Still not elegant. Better in this case: if b IS NOT NULL....
Admin
This is probably a financial application tracking Bonds... they use 360 day calendars.
/* note, system uses 360 days in a year, not 365 */
Admin
Admin
some old interest formulas use 360 days... makes numbers nice and round
Admin
Polygamy. How old is taylor swift. Bruce jenner. Red tailed hawk. Alma mater. Sixers game. https://kinotochka-serials.g-u.su
Admin
prb kosiwe https://tinyurl.com/27rr8nyn
Admin
uhz ljbtvn https://bit.ly/movies_937953_ruki_vverh
Admin
?_?; https://mari-tyrek.ru/45140.html
Admin
huan design iching cards
Admin
Fort wayne indiana. https://t.me/inewsworldplanet
Admin
Cessna. Aaron judge. Xenophobic. Braveheart. Itinerary. Vince vaughn movies. Los angeles international airport. Pound to kg. Copper. Cane corso puppies. Bobby flay. Belligerent. Magpie. Sweden. Vitamin a. Obsequious. Secret society 3. Bloomberg news. Charlotte north carolina. Castor oil. Verbena. Hugh grant movies. Laid. Moonrise kingdom. After death. Glean. Acetylcholine. Dementia symptoms. Cinderella man. Goblin. Horizontal. Subpoena. Mlk day 2024. Amaz. Pitbull dog. Scarlett johansson movies. Norse. Guadalajara. Manage. Mint. Pri. What national day is it. Myanmar. 22 jump street. Ariana greenblatt. Mn wild. Magnanimous. https://2025.uj74.ru/KTGLF.html Chelsea f.c.. The marvelous mrs. maisel. Fight club. Sofia coppola. Occams razor. Liechtenstein. Caveat meaning. Triple frontier. Beavis and butthead. Donna summer. Eazy e. Virgin mary. Ellen barkin. Athletes foot. Drink. Joel embiid. Dark web. Sigma meaning. John nash. Frank lloyd wright. Loofah. St louis mo. Penny. Fossil fuels. Ps1. Sundry. Blur. Evay. Csi miami. Rookie of the year. Superbad. 777. Pokemon games. Oh. Komodo dragon. Birth chart. The thing. Pastries. Tentatively. Thalamus. Cardiovascular. Neurologist. Carmelo anthony. Ann margret. Cynthia geary. Ii. Casey. Brachiosaurus. Permanent. Senna.
Admin
Sebastian bach. Prenup. James webb telescope. Allan lichtman. Nix. Kevin hart movies. Discernment. Orientation. Sheep. Christmas tree. Calligraphy. Organization. Grotto. Edict. Pig latin. Celery. History of thanksgiving. Eddie murphy movies. Consolidate. Pilgrim. Olivia de havilland. Harold ramis. Lid. Autotroph. Proboscis monkey. Shibuya. Pregnant. Michael c hall. Rick rubin. Wainscoting. Daniel ricciardo. New girl cast. Terminator 2. Grimace. Whole food. Brutalist architecture. Overboard. Christ the redeemer. Russian alphabet. Senate. Johns hopkins university. Tornado watch. Empanadas. An. Skyscraper. Brooklyn college. Elliott gould. Seattle storm. Lamprey. Rutgers. Samuel l. jackson. Plano weather. Princess catherine. Mayfair. Soil. https://nojiajm.delaem-kino.ru/LNEIF.html Overstimulated. Promiscuous meaning. Flip. Extinction. Donut. Deuteronomy. U tube. Isle of man. Detroit red wings. Resilience. Patton oswalt. Prophet. Software. Erin brockovich. Colitis. Elements. Catalina island. Send. Dictionary.com. Madonna. How many oceans are there. Shakespeare. Rochester ny. Guarantee. French horn. Anne of cleves. Big fish. Energy. Aaron judge stats. Ithaca. Henry cavill movies and tv shows. Dow jones index. Yaho. Draco. Omaha. Trident. Caravaggio. Neil degrasse tyson. Neon. Heath ledger filmography. Aarp. Angola. Chickadee. Montana. Louis gossett jr. Raynauds syndrome. Seals. Rose bowl. Demolition man. Stephen merchant. Gastroesophageal reflux disease symptoms. Dodecahedron. Where is taylor swift from. Representative. Ronald reagan washington national airport. Sacha baron cohen. Memento mori and. Tom petty songs. Acetaminophen.
Admin
u233000 browse around this site t233079