- 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
It doesn't refer to the monetary unit, but the weight unit (really force if you are pedantic), i.e. 5# potatoes.
Admin
Um, that was deliberate - to discourage writing of such code.
Admin
The compiler will accept it but those casts are discouraged in proper C++. A C++ programmer is supposed to use the static_cast<>() thingy - which will fail.
Admin
Admin
It's a little archaic now, and rarely seen outside the food industry. In this context the symbol is a simplification of a combined "lb" with a line across the top (℔).
Admin
Sorry for the jerkiness yesterday, it's just my way.
Now that I realize your example is C++, not C#, a much closer C++ approximation would be:
That should illustrate the non-utility of the function in the article.
Admin
[quote user="Doug"][quote user="frits"] The secondary reason is to make casts stand out more visually: "An ugly operation should have an ugly syntactic form."[/quote]
In C++ pretty much everything has "an ugly syntactic form.".
Admin
If you knew differences between c++ casts, you wouldn't write such nonsense.
Admin
[quote user="Escaped Lunatic"][quote user="Coward"] You cannot reinterpret_cast<float>(int). You need to do the ugly-fugly ((float)(&int)) instead. Well, I suppose you could do reinterpret_cast<float>(&int) , but that is just as ugly.
Ah, the joys of floating point formats not supported by the processor or the compiler... [/quote]
The reason that's ugly is because you should not be using a cast there. You should be using a union. If your floating point format is not supported, I imagine you would write a set of functions or a class for encapsulating this format which would use a union internally for performing the operations you want to perform. Overload operators and hey presto you've added support yourself, in one singular place. I feel you are blaming ugly code on a language you don't really understand.
Admin
If you don't click on sponsor links don't complain about anything. And never complain about the proofreading because that requires a second set of eyes, which I suspect Alex does not possess.
Now that I'm on Alex's good side, may I suggest that code snippets in articles explicitly mention the language? That would cut down on a lot of chaff in the comments.
Admin
CAPTCHA- Who cares what's in my captcha?
Admin
Agreed
Oh come on! I prefer my sniping to be platform-agnostic but I do enjoy reading other people's :o)
Admin
It is definitely seen in the engineering industry. An example is a 150# ANSI Standard Flange which is pronounced "150 pound". The pound is supposedly in reference to the pressure rating in pounds per square inch (psi), but the pressure rating is different depending on the temperature and the rating doesn't really appear in the list anywhere (though the rated pressure at 500 F is approximately double the rating for everything above the 150 rating).
CAPTCHA: wisi - We were blind, but now wisi.
Admin
Admin
Admin
I've seen at least three names other than "Alex Papadimoulis" in the bylines of TDWTF articles. Is your suspicion that these people are all really Alex in disguise, or that none of them have eyes?
Admin
I thought he meant that Alex doesn't wear glasses.
Admin
I'm sure crazy use of pointers would speed up some of the bits that aren't broken. I'm equally sure that direct implementation in Assembler is a rather better case, if that's really necessary.
Admin
If you're targetting one particular CPU type, fine, you can probably get away with just the asm, but then that's probably embedded.
What?
Oh, all right then. Probably embedded and without a file system.
Admin
[quote user="Anon-y-mouse"][quote user="Doug"][quote user="frits"] The secondary reason is to make casts stand out more visually: "An ugly operation should have an ugly syntactic form."[/quote]
In C++ pretty much everything has "an ugly syntactic form.".
[/quote]
Umm... That's deliberate, to discourage you from writing code in C++ </Flamebait>
Admin
Admin
On the last one. Are you guys total morons, or complete idiots?
It is writing HTML that's to be sent to a client, and it's optimizing the size of that HTML for slow connections, by removing some whitespace, at expense of script run time, which is likely to be entirely insignificant.
[ on the second, its a bit weird indeed if the cache is being read from in some different place. The first isn't a WTF, it lets you search for the cast; anyone who in fact EVER used C++ should be familiar with this (dynamic_cast, static_cast, etc), and furthermore anyone who used c++ and doesnt understand the casts and difference between them is a noob and should better refrain from any commentary ]
Admin
Admin
Admin
You, dear sir, are a moron.
Admin
[quote user="Anon-y-mouse"][quote user="Doug"][quote user="frits"] The secondary reason is to make casts stand out more visually: "An ugly operation should have an ugly syntactic form."[/quote]
In C++ pretty much everything has "an ugly syntactic form.".
[/quote]
so C++ was designed to discourage its use ;)
Admin
TRWTF is
in C++. Or C.
Static typechecking is way overrated. Testing is underrated.
Captcha: nulla (E van Vogt?).
Admin
The real WTF here is that in a proper OO codebase there's exactly zero need for casting.
But no codemonkey knows this. Because codemonkeys think that since they know how to code in Java/C# they know OO...
Admin
That's the reason for many WTFs in this world - people showing off how smart-ass and witty they are about others' mistakes. Like, come on, was it that difficult to tell this Senior Programmer that this does not do what he wanted, and make the world a better place ?
Instead of making a fool of yourself, my College Student friend.
Admin
Call me weird, but from the title I had assumed that this posting involved someone doing something bizarre in an FP language like Haskell (where 'pointless design' is a common approach, if somewhat hard to master).