|
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.
|
|
|
|
|
I wont, you can't assign to an rvalue.
UNLESS 1 is actually a macro that expands to something that makes sense on that context, but I don't even know if a macro can be called 1.
|
|
|
|
|
You cannot write a macro beginning with an digit.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
I'm digging deep into the past, but I believe that with MS QuickC, it may have allowed the compile. Upon execution, memory offset 1 would be overwritten with 1. Possibly an immediate crash, or more likely, a crash waiting to happen.
I know it'd work with a cast to a pointer. QuickC was rather forgiving at times. Some of those times it was to my regret.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I happened upon an if yesterday that was deactivated with:
if ( <big>false &&</big> ...
Personally, I prefer to build with warnings as errors, but this codebase throws thousands of warnings.
This space intentionally left blank.
|
|
|
|
|
Luckily the Mayans were wrong or perhaps doBestThing() would have executed a couple of years ago.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Madhanlal JM wrote:
if(1=1){
doSomeThing();
}
else{
doBestThing();
} I am waiting for the execution of else part
if (1=1){
doSomeThing();
Goto l;
}
else{
l: doBestThing();
}
Now the else part will run! Am I Correct? 
|
|
|
|
|
I am not a goto expert(thank God) but i believe you have to define I before the Goto part.
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|