| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:24
•
by
serguey123
|
|
First?
And no, this is not spam, you soulcrushing scrip! |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:25
•
by
Mythran
(unregistered)
|
|
This comment is very important. DO NOT TOUCH!
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:26
•
by
NotFirst
(unregistered)
|
|
bool memberHasFirstComment = bool.Parse(bool.FalseString);
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:31
•
by
Power Troll
|
That's what she said. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:31
•
by
Wormlore
(unregistered)
|
|
That is not the worst way to set a boolean to False.
Something like this would have been "less good" bool memberHasFingerprint = !bool.Parse(bool.TrueString); And I'm sure someone creative enough could come up with something worst yet. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:31
•
by
Rictor
(unregistered)
|
|
Seems like this programmer had a bit of a potty mouth...
Private Function FnPtrToLong(ByVal lngFnPtr As Integer) As Integer |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:32
•
by
Bobbo
(unregistered)
|
throw new AccessViolationException("Ouch, that's cold"); |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:33
•
by
DOA
|
The one constant in every software development department. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:34
•
by
frits
|
. Really? Replace them when you see them? You would think there would be an automated way to "find and replace" such "atrocities" with such a useful "fix". Nevermind the fact that this fix is as least as dumb as the original. At least. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:35
•
by
trwtf
(unregistered)
|
The loop makes it more random, you see... |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:37
•
by
tim
(unregistered)
|
|
Actually I remember doing something like the 'pointer to long' in fortran on VMS once
IIRC fortran didn't have pointers but it was possible to call C functions like malloc. however, the only way to get the return value from malloc into an int was to hide it inside an additional layer of function call because fortran is less funny about type coercions across function boundaries but of course if that example wasn't VMS fortran then it is a WTF ;-) |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:40
•
by
XX
(unregistered)
|
|
A good developer never forgets about FileNotFound.
bool memberHasFingerprint; try { memberHasFingerprint = bool.Parse(FileNotFoundString); catch (FormatException) { memberHasFingerprint = !bool.Parse(bool.TrueString); } |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:41
•
by
tim
(unregistered)
|
oh go on then bool memberHasFingerprint = (bool.Parse(bool.TrueString) == !bool.Parse(bool.TrueString)) (i can feel the slippery slope coming on) |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:41
•
by
luis.espinal
|
|
Aaron's code comment feel deja vu to me from one project I endured many moons ago... like man, it does speak to me, like, literally!
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:42
•
by
boog
|
Sounds like this crap should be in his journal. Or if you check there maybe you'll find useful comments about the code? |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:48
•
by
Gary
(unregistered)
|
FTFY. Even more random now. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:49
•
by
ShatteredArm
|
if (oneHundred == 100) {
Looks like oneHundred can be anything except 100. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:49
•
by
digitalwitch
(unregistered)
|
There is something to be said for readability. Just because you can do something in one line doesn't mean you should. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:51
•
by
Anything you can do, I can do worse
(unregistered)
|
|
bool memberHasFingerprint = true; // set fingerprint presence to false...
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:53
•
by
Honest Guy
(unregistered)
|
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:53
•
by
Jellineck
(unregistered)
|
He just learned the coalesce operator and he wants to use it everywhere. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:54
•
by
Rand Dumm
(unregistered)
|
Shouldn't you loop a random number of times, so you don't get the same result every time you run it? |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:56
•
by
Anon
(unregistered)
|
Why test if an empty string is empty (if s is null)? Seem like inlining the code from the original functions would be better. Which is probably what the compiler does anyway. And it's more readable. Once again the suggested fix is TRWTF. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:58
•
by
Dazed
(unregistered)
|
|
Well, I'm all in favour of comments which explain why code was written in a particular way. Aaron's predecessor's comment isn't quite what I usually have in mind, but at least it heads off all the folks around here who cry "what the hell were they thinking?"
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 11:59
•
by
Bosshog
(unregistered)
|
In Soviet Russia, Integer divides *you*. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:01
•
by
Bobrot
|
I remember that one. French guy had to see the site in English. (some sort of language preference was just too easy) |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:05
•
by
Ikkonoishi
(unregistered)
|
bool memberHasFingerprint; WebClient wc = new WebClient(); string[] fs = wc.DownloadString("http://msdn.microsoft.com/en-us/library/system.boolean.truestring.aspx").Split("\"",3000); foreach (string fss in fs) { if (s == bool.TrueString) memberHasFingerprint = !bool.Parse(fss); } |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:07
•
by
kastein
(unregistered)
|
bool memberHasFirstComment = bool.Parse(bool.FalseString); users.NotFirst.comment = bool.Parse(memberHasFirstComment); |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:09
•
by
Patrek
(unregistered)
|
|
Got that in code I had to maintain (another language, but still):
boolean isVerified = temp.equalsIgnoreCase("yes") ? new Boolean(true).booleanValue() : new Boolean(false).booleanValue();
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:10
•
by
Timmorn
(unregistered)
|
Fixed it for you |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:13
•
by
RBiter
(unregistered)
|
|
.. whew! cuz I thought it was from someone in my place. I certainly recognize that number!
; |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:16
•
by
Pyrexkidd
(unregistered)
|
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:17
•
by
Ancient Greek Guy
(unregistered)
|
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:18
•
by
ContraCorners
|
|
But, FnPtrToLong neither accepts nor a returns a long. Both are integers, no?
Or was that the WTF? |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:39
•
by
Anon
(unregistered)
|
Priest function? |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:39
•
by
Bob
(unregistered)
|
|
"[D]evised by IT iliterate[sic] decision makers without a clue what it's[sic] should do or who wants it."
Was he being ironic? |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 12:50
•
by
forgottenlord
(unregistered)
|
Ok, I've never seen this operator before. Yes, it is a flash of ignorance on my part, though a quick check through the code base of my company's code (and there have been a fair number of C# developers here) I can't find a single instance of it being used. Why, we just didn't, collectively, know it. Mind you, most of us got our degrees while programming in Java or C/C++ so maybe it is just that it wasn't part of those languages. Either way, it's not really a WTF. It's a failure of knowledge rather than technique. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 13:07
•
by
the beholder
(unregistered)
|
See, our store is having this great sale on sarcasm detectors... |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 13:14
•
by
NOT an ancient Greek guy
(unregistered)
|
Nah, he's just an ancient Greek. It's cool. They touch the colons of boys all the time. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 13:18
•
by
Andrew
(unregistered)
|
It looks like RealBasic to me. RB allows mixing and matching of numeric datatypes through implicit coercion so that you can pass a 64 bit signed number (Long) to a function that accepts 32 bit signed numbers (Integer), return an Integer and treat it like a Long. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 13:22
•
by
frits
|
Yeah I don't think so. Sarcasm involves intentional irony and humor. Show me those two elements. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 13:43
•
by
Mordred
(unregistered)
|
|
What we are looking at here folks are samples from the pioneers of coding. If it weren't for these idiots, why we wouldn't have the super idiots we have today.
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 13:44
•
by
Coyne
|
|
Actually, it turns out that the longer version of the IsNullOrEmpty() test that Anthony Arnold reported was needed in earlier versions of .NET. See:
DANGER ! String.IsNullOrEmpty can lead to runtime Null exceptions !! So which is the bigger WTF here: Writing it this way? Or having to write it this way because your compiler doesn't optimize right? P.S. ...and, to top it all off, Anthony might be doing the wrong thing. Let's hope his compiler works right. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 13:47
•
by
Anon
(unregistered)
|
I don't think it existed before the introduction of nullable types in C#. I wasn't familiar with it either having start with .NET 1.0. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 13:56
•
by
frits
|
Anthony's method is functionally equivalent as far as null checking goes. TRWTF is having a method called "IsRealString" that checks an object instead of a string. In other words, the call to .ToString() is the fly in the ointment here. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 14:01
•
by
boog
|
Not an easy task. Sure, one can show humor simply by laughing (ha), and it's clear that the "fix" was ironically as bad or worse than the original (you've admitted that yourself). However, the challenge lies in proving that these traits were intentional. Certainly the reader inferring the submitter's intentions would be subjective, and therefore worthless. What we need is some form of empirical evidence proving that the submitter intended to be ironic and humorous, or that said irony/humor was purely accidental. This may take a while. Oh, wait. This is a forum on the internet, so no one cares. My mistake. |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 14:03
•
by
ÃÆâ€â„
(unregistered)
|
|
What, so you guys don't touch your colons? Boy, are you missing out.
|
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 14:12
•
by
Two
(unregistered)
|
oracleDbPortNum = 1521 |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 14:15
•
by
yetihehe
(unregistered)
|
|
<?php include sitename(__COMMENT__).'/../../../omgponies.com/public_html/comment_view.php'; ?>
on the other hand, they could do it like this: eval(file_get_contents('othersite')); |
Re: CompareObjectAsIAlertDocumentOrNullIfNotCastable and More
2010-12-20 14:15
•
by
Two
(unregistered)
|
Unless it starts out at 200 ... |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |