- 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
return isFrist("FILE_NOT_FOUND"") ? TRUE : TRUE;
Admin
Perhaps the person comes from a C++ background where invoking a [non-virtual] method on NULL [nullptr] is actually (And unfortunately, in most cases) quite possible...
NOTE: we use uppercase numbers, lowercase numbers did not make it into any (that I know of) fonts - the characteristic is thet 3,4,5,7,9 all descended below the bottom (like many lower case letters [p,q....]
Admin
Well, in some languages you can call method on a null reference. "this" is passed as first hidden parameter, so as long as you not use any fields it works OK. Not in Java, though. Still a WTF.
Admin
if you use stringly-typed numerical values, you should check upper and lower case, because of: 0x3D7F != 0x3d7f
Admin
IsAll() was because accidentally the whole thing.
Admin
There are upper case numbers https://graphicdesign.stackexchange.com/questions/54423/why-dont-upper-case-numbers-exist
Admin
Don't worry. They remembered to use the case-insensitive comparison function, so both lowercase and uppercase zero compare correctly!
Admin
An upper case 0 is clearly an O. Lower case 0 would be o.
Numeric case L would be 7. Numeric case l would be 1...
Perfectly consistent.
Admin
Clearly the moderate function here uses isAll()
Admin
obligatory XKCD reference https://xkcd.com/2206/
Admin
Maybe they should use the
isAll()
function to check whether integers are uppercase or lowercase xDAdmin
This WTF is easily fixed simply by renaming the function to
isAllThisAndABagOfChips()
.Admin
perhaps it's short for IS ALLocated... In which case checking for
this == null
has approximately nothing to do with anything.And in C++, calling any non-static member function on a NULL object pointer is UB, regardless of anything. It's normally sudden death if the function is virtual, owing to the very common mechanism of finding the function in the vtable which is referenced by the
this
pointer, but if the function is non-virtual and prevents itself from referring to the contents of the object, you might get away with it.Admin
§ is my shifted 3. lol
Admin
I'm old enough to remember typewriters that didn't have a
1
key, you repurposedl
. So uppercase 1 would beL
.And exclamation point was
'<backspace>.
Admin
Georgia is a commonly available typeface which uses lower-case numerals. Unfortunately, they are not equal-width numerals, so they don't work well for tables or spreadsheets.
Admin
"using strings to hold numeric values" problem
Worse - it looks like it's a "using strings to hold numeric values that you're using as booleans" problem.
Thanks - I hate it.
Admin
A surprising amount of people are concerned over instance addresses for functions not needing instance addresses.
Admin
Maybe it’s not Java at all but ValleyGirlLang.
If beach.isAll(“totally_awesome”) then surf.isLike(“gnarly”)
Admin
To be fair,
isAll()
is a general test for existence – for the existence of the computer it is running on, the universe, and all. As such, it is sensibly named, as well. ;-)Admin
1 see 1'm not the only one who remembers Selectric typewriters.
Admin
A friend asked ChatGPT to produce some code for converting uppercase to lowercase (I can't remember what language), and it came up with something that converted "+" to "-" and "*" to "/".
Admin
My reading is that the method used to detect the end of a null-terminated sequence, like C strings or the argv array, and therefore it is meaningfully named.
"Undefined behavior" is not a synonym for "impossible" nor "guaranteed to crash." Successful compilation and execution in some implementation-determined manner is an option. Indeed there is a long tradition of "failure-oblivious" computing where continued operation is prioritized over detection of errors.
Admin
Oh, I just realized that this is Java and not C++. NEVER MIND.
In penance for my mistake, can I offer the story of a co-worker who wrote Java test cases that expected a constructor to throw an exception, but also asserted the values that the same constructor returned?
Admin
Maybe they thought all is the opposite of null. So, instead of calling the method isNotNull, they called it isAll
Admin
Depends on the language. Some languages only die if you use the pointer--the code in question never does and thus would be fine. Assuming such a language this is actually "IsAllocated" written inefficiently.
Admin
I'm imagining that this class has a number of isX() methods, which can be used / passed as parameters to some filtering methods. isAll() is then the dummy method you use when you want all the instances, except of course nulls. The fact that this won't actually filter out nulls the way they hope it will is the only problem, and is either a brainfart, or as already suggested, someone coming from another language where it would actually work.
I want to know what other values "isCheckedOut" can be set to. Looks like someone coming from a weakly typed language with too many truthy/falsey gotchas.
Admin
Should have been a "representative-line" story?
Admin
IsAll() isn't a WTF. It's poetry. It's creative writing at its purest form. I'm sure there's an Edgar Poe poem titled "isAll()" somewhere.
Admin
Upper class numbers = ° ¹ ² ³, working class numbers = 0 1 2 3, lazy case 7 = ¬, deceased case 8 is ∞ and that isAll(Volks);
Admin
public class AllIsPossible { public static bool operator ==(AllIsPossible obj1, AllIsPossible obj2) { return true; }
public static bool operator !=(AllIsPossible obj1, AllIsPossible obj2) { return false; }
public bool isAll() { if (this == null) { return false; } return true; } }
Admin
True, but it's worth remembering that the "some implementation-determined manner" can easily be something you didn't intend, and, even worse, that (being implementation-determined) it varies between environments in ... surprising ... ways. Like what happened to me back in '96, when all the compilers in the company compiled ==>> that function there the same way, until I tried to run the code on my team's hardware platform. The x86-32 Linux build (gcc 2.something, but before the gcc/egcs split) for the simulator worked fine, but the specialist gcc (also 2.something, 2.5.8, I think) for our R4600 MIPS-based hardware did something ... different.
Admin
In Objective-C, it is legal to send a message to
nil
(the equivalent of Java'snull
), thus the Objective-C equivalentis perfectly legal and messages sent to
nil
are defined to return 0, which Objective-C will interpret as false, so this is legal and functionalOf course, you could just write
which many people would argue is quite a bit better.
Addendum 2023-10-26 09:53: Regarding
isAll
I wonder if somebody was trying to write anisNotNull
function and settled onisAll
as being the opposite ofisNull
.Admin
Probably this used to do something useful but the functionality got deleted later.