|
<voice type="Ebeneezer Scrooge"> Bah. dumb bugs </voice>
|
|
|
|
|
Few days back I came across following code
if(gender.contains('male'))
{
DoMaleThing();
}
else
{
DoFemaleThing();
}
Was not sure whether my colleague was knowing that 'female' option also contains 'male' in it.
Had a great laugh with my TL when I showed him this.
Do not go where the path may lead. Go instead where there is no path and leave a trail.
|
|
|
|
|
Well... Didn't you know it would have been discriminating otherwise
|
|
|
|
|
Ohh..now I understood the code who wrote this is a lady
Do not go where the path may lead. Go instead where there is no path and leave a trail.
|
|
|
|
|
If you put some effort to it you can mess up an enum too.
|
|
|
|
|
Lost in translation? It would work in most other languages.
Also, he could consider: ladies first!
|
|
|
|
|
Years ago, I worked on a pension system and one of the calculations was to find the retirement age, the standard function was [converted to C# as I can't remember Prolog]:
int normalRetirementAge()
{
if (isMale())
{
return 65;
}
else
{
return 60;
}
}
Now, one client had everyone on their scheme retire at 60 irrespective of sex, the proposed solution by the PFY:
int normalRetirementAge()
{
if (isMale())
{
return 60;
}
else
{
return 60;
}
}
speramus in juniperus
|
|
|
|
|
Sure, gotta leave the if/else logic in there in case it is needed later.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
|
RyanDev wrote: Perhaps it's like mailman.
which evolved to "letter carrier" (because "mailperson" still sounds like it is referring to "male")
like "stewardess" became "flight attendant"
|
|
|
|
|
After Jenkins built the setups, it starts a virtual machine, installs our programs there, and performs some integration tests.
Just recently our server has been migrated from VMWare Server to vSphere.
In order to start with a "clean" machine, a snapshot is restored - that can be done only when the machine is powered off. But I get an error when trying to power off the virtual machine:Quote: The attempted operation cannot be performed in the current state. Well, true, the virtual machine is already powered off, and consequently it cannot be powered off... Logic, isn't it?
|
|
|
|
|
Yes, it is. But it would be more logical if we wouldn't be able to power off the machine, which is already powered off.
|
|
|
|
|
AFAIK, VBox simply returns 0 (Success) if you try to power off a machine that is already powered off through the VBox Management API, which makes sense to me.
<voice type="Ebeneezer Scrooge"> Bah. dumb bugs </voice>
|
|
|
|
|
As found in some VB code:
Try
Catch ex As Exception
End Try
I may be posting a lot of these things here, as I finally got hold of the VB code that was for the previous system, that we're re-writing in C#.
It's bound to be full of gems like this.
Marc
|
|
|
|
|
The .net equivalent of On Error Resume Next
|
|
|
|
|
I have seen that kind of code fail. Don't ask how, as I don't know.
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
You mean there was no code at all between Try and Catch , nor between Catch and End Try ?
At least, he ought to have added an empty Finally then.
|
|
|
|
|
Bernhard Hiller wrote: You mean there was no code at all between Try and Catch , nor between Catch and End Try ?
That is correct. I did not remove any code. It was a completely empty try-catch block.
Marc
|
|
|
|
|
Marc Clifton wrote:
Try
Catch ex As Exception
End Try
Marc Clifton wrote: I did not remove any code. It was a completely empty try-catch block.
Leaving the try...catch block empty was intentional. There exists a form with a textbox in which you can type code to be inserted in the try...catch block at runtime.
|
|
|
|
|
Then it's too bad the optimizer will remove it.
This space intentionally left blank.
|
|
|
|
|
Today I came across the following code
if (1=1){
doSomeThing();
}
else{
doBestThing();
}
I am waiting for the execution of else part
|
|
|
|
|
Quantum computing when all is possible at the same time?
|
|
|
|
|
Madhanlal JM wrote: if (1=1){
That does not even compile on any braced language i know of.
(yeah, i'm just nitpicking)
|
|
|
|
|
well, it will compile for C and C++ at least!
you young spring chicken! :P
|
|
|
|
|
Are you sure it will compile? '1' is not an l-value.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|