- 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
Batman() makes perfect sense to me!
Admin
Oh No! Inline SQL ! Are you sure an inexperienced maintenance programmer didn't write that?
;-)
Admin
I've seen a function named 'sht()' (autocensored) - and there was even a comment:
// Function does a sht
private void sh*t()
{
[...]
}
Sorry, no screenshot :(
Admin
What is a function?
Admin
Good question.
Admin
Well WTF are you doing testing a string for less than -1 when you just found out it is NULL?
I mean:
If IsNull(strFileName) Then If Len(strFileName) < -1 Then Exit Function
Have you ever tested this function with a null string? Or am I having a senior moment here or something? WTF do you expect to happen if strFileName is null?
Admin
Jim,
<pedant mode>
The code is checking the Len against 1 rather than -1.
</pedant mode>
Obviously, if strFileName was ever Null () then the Len call will raise error 94 - Invalid Use of Null (since Null does not have a length by definition).
Note to C programmers if they feel inclined to disagree - VB's Null is different to C's NULL. VB's Null has nothing whatsoever to do with strings (ie VB 6's Null is different to C's idea of a 'null string').
Seeya
Matthew
Admin
My point exactly. The purpose of the test is to exit the function gracefully if a null or empty string is passed, or if an empty one is passed. As written, it will not do that, all it will do is throw an error. Great teaching tool. Not.
Admin
I'm batman().
Admin
My guess is he saw that isnull is a good way to catch a bad input, and he saw that testing for len 0 (or is he expecting a negative string length?) is another good way to catch them... so why not COMBINE them for maximum usefulness and efficiency? Hey, there's an idea! =D
Admin
I also like the way he declares a variable for the name of a table and then doesn't bother using it, genuis!
Admin
$myhtmltemplate = <<< Myubberprogrammerwashere
(html here)
Myubberprogrammerwashere;
Hey, it's perfectly valid HEREDOC format! What's so wrong with it? :P
Admin
Of course you could also have gone with :
dim thelights
etc.
Admin
It's perfectly obvious why this function is named this way. It's so you can write brilliant code like:
If TheRiddler.HasEscaped Then Call Batman()
Makes perfect sense to me.
Admin
Well, actually he does use it, genius!
Admin
Oh no! I just read that
What will happen to Gotham now?