| « Prev | Page 1 | Page 2 | Page 3 | Next » |
|
I see the truth - this is for those tribool cases where File-Not-Found just won't do!
|
|
Better yet:
private static bool GetTrue() { return false; } I leave the third alternative an exercise to the reader. |
|
Truly enlightening.
|
|
Just in case you ever decide that TRUE isn't "true"... you'd only have to change this function instead of a global search/replace in all your code... Makes perfect sense ^.-
|
|
I don't understand what the WTF is...this is obviously a master of soft coding at work. I mean, who hard codes boolean values these days anyway?
captcha: muhahaha, nuff said |
Re: Seeking the Truth
2007-05-14 10:38
•
by
Sad
(unregistered)
|
The Windows API has precisely this kind of "triboolean" function. GetMessage() returns a BOOL that can be TRUE, FALSE, or -1. Go figure! |
Re: Seeking the Truth
2007-05-14 10:40
•
by
Stephen Sweeney
(unregistered)
|
// // You can't handle the truth :) // private static bool GetTrue() { System.exit(1); } |
|
The REAL WTF is stereotyping goths as "fat weirdos who worship satan".
"TheDailyWTF" is too offensive because of the "F", but it's just fine to stereotype? WorseThanFailure = worse than failure. |
|
I just found this in the code I'm working on.
static char* Dash_I = "-I"; static char* Dash_D = "-D"; static char* Dash_A = "-A"; static char* Dash_P = "-P"; (...) |
|
This fulfils the code equivalent of the nerd stereotype for saying "for a given value of true"
if anyone mentions file_not_found I'm going to shoot a puppy |
|
he didn't stereotype goths as fat weirdos who worship satan.
He stereotyped fat goth weirdos as satan worshippers. If you are going to get your panties in a bunch, at least be accurate about it. |
If it helps, I don't associate goths with satan worshippers. I would just make it "pale, fat weirdos" but then the religious context is lost. |
Re: Seeking the Truth
2007-05-14 10:52
•
by
whicker
(unregistered)
|
What about the crazy "crazy celebrities in Xenu" crazy statement. That's just craaaaaaazy. |
Re: Seeking the Truth
2007-05-14 10:53
•
by
Dave
(unregistered)
|
Spoken like a true fat weirdo who worships satan :P |
|
Alas, the truth is out of scope for me. Forsooth! 'Tis declared private!
|
Re: Seeking the Truth
2007-05-14 10:54
•
by
Not First
(unregistered)
|
yeah, but how are you supposed to test it? This is much better. private static bool GetTrue() { IoCContainer myContainer = Configuration.GetContainer(); Object oFact = myContainer.GetObject("IFactFactory"); IFactFactory fact = (IFactFactory) oFact; Object oConfig = myContainer.GetObject("IFactConfiguration"); IFactConfiguration config = (IFactConfiguration) oConfig; IFactResolver resolver = fact.CreateFactResolver(config); return resolver.GetBooleanResultProvider().GetTrue(); } |
|
private static bool GetTrue() { return File_Not_Found; } |
|
I'd like to see a use case for this.
I've wrote this exact same function a few weeks ago for testing purposes. I was testing a function that took a function pointer as an argument and wanted to test it against a function that always returned true. In effect its a mock function (as apposed to a mock object). |
|
It must be a Scientology class as the truth is private and only accessable to members or friends.
|
|
how bout
private static bool GetTrue() { return !false; } or private static bool GetTrue() { return true == true; } or private static bool GetTrue() { return true.Equals(true); } or private static bool GetTrue() { return "maybe I should stop" != string.Empty; } i could go on and on, you see there are many variations of the truth |
Failure to read the article before calling "hate crime" = worse than failure. The article reads:
Whereas you seem to have read:
These two statements are not the same. |
Damn right. Many Goths don't really worship Satan. And much as Alex can be commended for his unwavering perseverance in this matter, I really don't know anyone else who takes the "worse than failure" silliness seriously. A WTF is a WTF and that's that. You can call your new kitten "dog", that doesn't make it one. |
|
In relation to the 'You can't handle the truth' comment, found within our test code:
... assertFalse("Oops!", !(!booleanFlag)); ... I only assume this particular snippet started it's prolific life as the following: ... assertFalse("Oops!", booleanFlag); ... and, that after careful research and testing, it was found that jUnit's 'assertTrue()' call wasn't nearly as reliable as 'assertFalse()'. In fact, this was so carefully tested that it has been repeated thousands of times within the code base. I won't even get into the number of occasions where the booleanFlag is assigned and then immediately asserted. It would seem we can't even trust the JVM anymore. |
Whoever wrote that was likely passing those character constants to a function that didn't take const arguments because "const is too hard." |
So... You are into goth |
|
They don't even test the true value before they return it ... it should have been
private static bool GetTrue() { if (true) { return true; } elseif (true == true) { return true; } elseif (true == false) { return false; } else { return (false == true); } } |
|
This makes perfect sense for use in a boolean returning callback function. GTK+ has gtk_true() and gtk_false() for exactly that usage, for example.
|
|
I had some theories about how this could be useful function, but they all vanished when I read again the declaration "private static"
|
|
I won't swear this is true since it appears in the Unix fortune program's database of jokes, silliness, and pithy quotes but it's still amusing:
|
|
private static String IsReadyForEnligthment(String sName) {
if (getTruth()) Return sName + "is ready for enligthment"; else return "PEACHES!!!" } |
You just about made coffee come out my nose! |
Re: Seeking the Truth
2007-05-14 11:37
•
by
Calli Arcale
(unregistered)
|
pi is a mathematical constant and therefore will never change, but the *precision* of it might. So the value your program actually uses for pi may well change. After all, 3.14 and 3.14159 are not the same thing -- but both are legitimately used as values of pi. |
Re: Seeking the Truth
2007-05-14 11:41
•
by
Zygo
(unregistered)
|
Sounds like one of my CS courses. The first lecture covered invariants, preconditions, postconditions, and classes. Every subsequent assignment, test, midterm, and exam required slavish documentation of all of these, and implementation of them in code, so every method, no matter how trivial, looked like:
Leaving out one or two of these asserts would quickly dimish the author's overall mark by almost half, so we learned to write this crap every single time (yes, including the two identical asserts documented separately as preconditions and invariants). The "== true" form was required since we weren't allowed to take advantage of bool/integer equivalence even if it is a documented feature of an international standard. That kind of thing can scar you for life. It took years to break out of that habit. (Well, OK, maybe the third week of the next term, when the academic focus shifted to new topics, and we made a deal with the TA who was as sick of reading this crap as we were of writing it...) |
|
And, of course, we're getting Google ads about the Song of Solomon.
|
But what about pudding?? I keep responding to the gold spammers in Wow with pudding. They don't seem to like it much and never respond. :( Pudding is always the red-haired stepchild of the family. -- Seejay |
Re: Seeking the Truth
2007-05-14 11:57
•
by
Zygo
(unregistered)
|
I was about to use some STL examples of boolean functors, but you beat me to it. C++ code is full of creatures like this, because function objects are the arguments of so many methods, classes, and functions. Other examples: * the "identity" functor, a unary function that returns its own argument. * the "noop" functor, a unary function that ignores its argument and returns nothing. * the "constant" functor, a zero-argument function that returns its constructor argument value over and over. |
|
I suggest in fact, we need a complete interface, consisting of the following methods:
private static bool getTruth(); private static Set<bool> getWholeTruth(); private static Set<bool> getNothingButTruth(); |
|
I think that in order to truly explore the philosophical implications of the enduring and never-ending search for truth, this function must be recursive.
|
Re: Seeking the Truth
2007-05-14 12:01
•
by
Zygo
(unregistered)
|
We are? Maybe you are, but I'm not:
I assume that "Satan" is the trigger word for "New Christianity"? |
|
|
Yep, that's really bad coding. It should be one of the below:
return not GetFalse(); // ties them ---------------------------------------------------------- return GetRegistryValue( 'SYSTEM_CONSTANTS\Boolean\TrueValue'); ---------------------------------------------------------- return ( 999 == 999 ); // test hardware |
|
I just tried to GetTrue() my life, but all I got was a compiler error. Something about unable to call a private method....
I guess the truth is hidden and only available to those that successfully call GetEnlightenment(). |
|
There is actually a use for this. Visual Studio gives a warning about unreachable code, so if you try to comment out code with if (false) it will give a warning. Using if (!GetTrue()) doesn't get flagged.
|
|
I don't know much about Java, but in C++ a function like this may be useful: suppose that some piece of code that you're calling takes a bool-returning callback ( bool (*callback)() ), and you want your callback to do nothing.
|
Re: Seeking the Truth
2007-05-14 12:31
•
by
gygax
(unregistered)
|
|
private static bool GetTrue()
{ Deity GOD("Elohim"); return GOD.rollDice(1); } |
|
I'm voting that this code is C#. If it were Java, it would probably be called
getTrueinstead of GetTrueJava programmers seem to almost universally follow that convention, while .Net uses initial caps even for methods. Because C# has delegates, there is actually plenty of room for a function such as this as a callback function, as many people have said. It might be a WTF, but it might not be. |
|
I'm surprised no one has suggested:
bool GetTrue() |
Re: Seeking the Truth
2007-05-14 13:16
•
by
James
(unregistered)
|
|
Nah, if it were a Scientology class, it would look like this:
|
The precision of the floating point variable holding the number won't change that often either. It's a joke, used to ilustrate a useful concept. Get over it. |
Personally, I like my panties in a bunch, especially while fat goth weirdos are worshipping me. |
| « Prev | Page 1 | Page 2 | Page 3 | Next » |