I just made a secret GOTO
-
while(true) // repeat after upgrade
{
thingie.Open();
if (thingie.Stale() && YesUserReallyWantsToUpgrade())
{
thingie.Close();
continue;
}
// ...
break;
}On the plus side, I've had secret santa's that were worse. On the down side, that would look better with a goto, which doesn't sound exactly good.
-
while(true) // repeat after upgrade
{
thingie.Open();
if (thingie.Stale() && YesUserReallyWantsToUpgrade())
{
thingie.Close();
continue;
}
// ...
break;
}On the plus side, I've had secret santa's that were worse. On the down side, that would look better with a goto, which doesn't sound exactly good.
We can hide goto[^] even better:
bread.Open();
try
{
if (bread.Stale() && Banana()) // better naming!
{
throw DamnUserSeeksDooom();
}
// ...
}
catch (DamnUserSeeksDooom DUST)
{
dust.Sweep();
}
finally
{
bread.close();
}Teez javaOOP style. The more blue words the more proffesional code looks, you know. :rolleyes:
Greetings - Jacek
-
while(true) // repeat after upgrade
{
thingie.Open();
if (thingie.Stale() && YesUserReallyWantsToUpgrade())
{
thingie.Close();
continue;
}
// ...
break;
}On the plus side, I've had secret santa's that were worse. On the down side, that would look better with a goto, which doesn't sound exactly good.
So the thingie refuses to upgrade, because it does nothing as long as the user wants it to upgrade? What does it do if the user doesn't want it to upgrade? Does it upgrade in this case?
The good thing about pessimism is, that you are always either right or pleasently surprised.
-
We can hide goto[^] even better:
bread.Open();
try
{
if (bread.Stale() && Banana()) // better naming!
{
throw DamnUserSeeksDooom();
}
// ...
}
catch (DamnUserSeeksDooom DUST)
{
dust.Sweep();
}
finally
{
bread.close();
}Teez javaOOP style. The more blue words the more proffesional code looks, you know. :rolleyes:
Greetings - Jacek
Jacek Gajek wrote:
catch (DamnUserSeeksDooom DUST) { dust.Sweep(); }
i guess you swept your DUST before the actual call and it became smaler dust :D P.S sleeping only 5 hours isn't working well with my spelling skills.
Microsoft ... the only place where VARIANT_TRUE != true
-
So the thingie refuses to upgrade, because it does nothing as long as the user wants it to upgrade? What does it do if the user doesn't want it to upgrade? Does it upgrade in this case?
The good thing about pessimism is, that you are always either right or pleasently surprised.
That's a bit mroe complex than this simplified example of course (surprisingly, I don't have variales named "thingie" in there) - depending on the forma,t it's read only access or no access at all, indeed. Since the conversion runs in a separate process, I'm in the middle of a transaction, and I have to be careful to throw more milliseconds into that piece of code, tat "close, convert and retry" seems to be the best approach. Alternatively, I thought of an inner function that returns either the newly initialized session, or information about how to upgrade, but that code doesn#t look much better either.