BlnEvtName = blnEvtName == false? true : false;
-
yourfired = writecodelikethatagain == true? true:false
-
Never heard of the "!" ?
-
@shadowman said:
Never heard of the "!" ?
While it's certainly true that
is a more-than-adequate substitute for the!x
construct, before I went and blindly replaced one with the other, my first question would be "What the fsck does it even mean to be taking the boolean not of something that purports to be the name of an event?"x == false ? true : false
-
@DaveK said:
construct, before I went and blindly replaced one with the other, my first question would be "What the fsck does it even mean to be taking the boolean not of something that purports to be the name of an event?"
The bln prefix indicates that this variable is, in fact a boolean (or at least should be). Hungarian notation aside, apparently only two events ever exist, and they have the names 0 and 1. ;p
-
@jcoehoorn said:
@DaveK said:
construct, before I went and blindly replaced one with the other, my first question would be "What the fsck does it even mean to be taking the boolean not of something that purports to be the name of an event?"
The bln prefix indicates that this variable is, in fact a boolean (or at least should be). Hungarian notation aside, apparently only two events ever exist, and they have the names 0 and 1. ;p
This code has future IT manager written all over it.
-
the real wtf is that when making fun of the code, you used the wrong your.
Hmmm... my fired has been set
-
@jcoehoorn said:
@DaveK said:
construct,
before I went and blindly replaced one with the other, my first
question would be "What the fsck does it even mean to be taking the
boolean not of something that purports to be the name of an event?"The bln prefix indicates that this variable is, in fact a boolean (or at least should be). Hungarian notation aside, apparently only two events ever exist, and they have the names 0 and 1. ;p
proving once again that the best argument against using hungarian notation is reading code written with hungarian notation.
-
@SeekerDarksteel said:
@jcoehoorn said:
@DaveK said:
construct,
before I went and blindly replaced one with the other, my first
question would be "What the fsck does it even mean to be taking the
boolean not of something that purports to be the name of an event?"The bln prefix indicates that this variable is, in fact a boolean (or at least should be). Hungarian notation aside, apparently only two events ever exist, and they have the names 0 and 1. ;p
proving once again that the best argument against using hungarian notation is reading code written with hungarian notation.
Also fonts where the lowercase Ls look like capital Is. I
thought it was "b in event name", like a bool that represents whether
or not we're in the EventName function.
They should have at least used parenthesis to make it easier on anybody who doesn't know the order of operations off the top of their heads. I would have laughed if that was:
blnEvtName = (blnEvtName == (false? true : false));EDIT:
On second thought, that's the same thing too....
-
@DaveK said:
... my first question would be "What the fsck does it even mean to be taking the boolean not of something that purports to be the name of an event?"
I found this at work the other day:
bVar = Max( bVar + ( bNewVar ? +1 : -1 ), 0 );
After a lot of scratching we decided that it did the same as:
bVar = bNewVar;
Except that we found out that bVar is actually an int, not a bool.
-
@jcoehoorn said:
@DaveK said:
construct,
before I went and blindly replaced one with the other, my first
question would be "What the fsck does it even mean to be taking the
boolean not of something that purports to be the name of an event?"The bln prefix indicates that this variable is, in fact a boolean (or at least should be). Hungarian notation aside, apparently only two events ever exist, and they have the names 0 and 1. ;p
A boolean name?
I have no idea what this variable should hold.
-
@dhromed said:
I have no idea what this variable should hold.
I think it might indicate if another variable contains the name of an event or of something else.
Perhaps blnIsEventName would sound better to your ears?
I think TRWTF is that unparenthen..thi..si..ze.ded? whatever combination of = and ==.
-
@Zecc said:
@dhromed said:
I have no idea what this variable should hold.
I think it might indicate if another variable contains the name of an event or of something else.
Perhaps blnIsEventName would sound better to your ears?
isEventName sounds better. The hungarian note is redundant.
@Zecc said:
I think TRWTF is that unparenthen..thi..si..ze.ded? whatever combination of = and ==.
Yeah, I tend to put parens around assignment of boolean expressions as well:
isFoo = (relatedFoo <= maxBar);
And things like that.
-
>I think it might indicate if another variable contains the name of an event or of something else.
This might indeed be the case. This is actually a brilliant idea; you do not have to explicitely define variable types, plus you can use less variables. You can define all variables as objects and use booleans, enums etc. to indicate what the variables will contain. This way you can even change the very purpose of any variable in run-time.
For example;
'Note that you do not have to define variable type, which is usually a PITA
Dim objValue
'Do not define variable type, since these variables can be reused somewhere else as some other data type
Dim blnObjValueContainsCustomerName = True
Dim blnObjValueContainsExcelApplication = False'Somewhere deep in the code where no man has gone before
If blnObjValueContainsCustomerName = True Then
txtCustomerName.Text = objValue.ToString
Else
If blnObjValueContainsExcelApplication = True Then
'Note that in this case the blnObjValueContainsCustomerName variable contains the worksheet object
blnObjValueContainsCustomerName.Save
blnObjValueContainsCustomerName.Close
objValue.Quit
End If
End If
-
@sirhegel said:
>I think it might indicate if another variable contains the name of an event or of something else.
This might indeed be the case. This is actually a brilliant idea; you do not have to explicitely define variable types, plus you can use less variables. You can define all variables as objects and use booleans, enums etc. to indicate what the variables will contain. This way you can even change the very purpose of any variable in run-time.
For example;
'Note that you do not have to define variable type, which is usually a PITA
Dim objValue
'Do not define variable type, since these variables can be reused somewhere else as some other data type
Dim blnObjValueContainsCustomerName = True
Dim blnObjValueContainsExcelApplication = False'Somewhere deep in the code where no man has gone before
If blnObjValueContainsCustomerName = True Then
txtCustomerName.Text = objValue.ToString
Else
If blnObjValueContainsExcelApplication = True Then
'Note that in this case the blnObjValueContainsCustomerName variable contains the worksheet object
blnObjValueContainsCustomerName.Save
blnObjValueContainsCustomerName.Close
objValue.Quit
End If
End IfI fixed your post. :)
-
@Thief^ said:
@DaveK said:
... my first question would be "What the fsck does it even mean to be taking the boolean not of something that purports to be the name of an event?"
I found this at work the other day:
bVar = Max( bVar + ( bNewVar ? +1 : -1 ), 0 );
After a lot of scratching we decided that it did the same as:
bVar = bNewVar;
Except that we found out that bVar is actually an int, not a bool.
If you're using C/C++, this may not be a total WTF, but rather an oversight that you could do bVar = (bVar || bNewVar) unless I'm totally misreading this.
-
@Thief^ said:
@DaveK said:
... my first
question would be "What the fsck does it even mean to be taking the
boolean not of something that purports to be the name of an event?"I found this at work the other day:
bVar = Max( bVar + ( bNewVar ? +1 : -1 ), 0 );
After a lot of scratching we decided that it did the same as:
bVar = bNewVar;
Except that we found out that bVar is actually an int, not a bool.
Given the code snipplet, I would say bVar is a counter that increases every time bNewVar is true, decreases every time it is false, and can't go below zero.
-
@ammoQ said:
Given the code snipplet, I would say bVar is a counter that increases every time bNewVar is true, decreases every time it is false, and can't go below zero.
Yes, it is. The wtf is that it's prefixed as a boolean. If it WAS a boolean, then the line would be identical to bVar = bNewVar;
-
@Thief^ said:
@ammoQ said:
Given the code snipplet, I would say bVar is a counter that increases every time bNewVar is true, decreases every time it is false, and can't go below zero.
Yes, it is. The wtf is that it's prefixed as a boolean. If it WAS a boolean, then the line would be identical to bVar = bNewVar;
Ah, see this is the joy of Hungarian notation. bNewVar is a boolean, while bVar is a byte.
-
@asuffield said:
@Thief^ said:
@ammoQ said:
Given the code snipplet, I would say bVar is a counter that increases every time bNewVar is true, decreases every time it is false, and can't go below zero.
Yes, it is. The wtf is that it's prefixed as a boolean. If it WAS a boolean, then the line would be identical to bVar = bNewVar;
Ah, see this is the joy of Hungarian notation. bNewVar is a boolean, while bVar is a byte.
Bytes are just little strings of booleans anyway.