Re: Why is "False" = "-1"?
From: MikeD (nobody_at_nowhere.edu)
Date: 07/25/04
- Next message: Larry Serflaten: "Re: How to write debug utility functions"
- Previous message: MikeD: "Re: How to write debug utility functions"
- In reply to: Duane Bozarth: "Re: Why is "False" = "-1"?"
- Next in thread: Duane Bozarth: "Re: Why is "False" = "-1"?"
- Reply: Duane Bozarth: "Re: Why is "False" = "-1"?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 25 Jul 2004 11:09:30 -0400
"Duane Bozarth" <dp_bozarth@swko.dot.net> wrote in message
news:4103C7D3.2333083F@swko.dot.net...
> In a nutshell, writing "If A Then" is <precisely> identical to writing
> "If A<>0 Then" and will generate the same code and therefore the same
> execution time. (Excepting perhaps for a <very> dumb compiler and I
> believe Dan's article shows that the VB compiler isn't that
> dumb--actually a couple of his examples show better code generation than
> I had suspected). This is conclusion can be generalized to cover any
> and all of the cases/pseudo-examples you've previously provided--they
> all boil down to either an eq or ne and there has to be something for
> the machine instruction to compare to--whether it's zero or nonzero
> makes no difference.
OK. I can buy that. It was many years ago that I had heard and read (from
many different sources) that 'If A Then" executed quicker. I can see how
that may have been the case prior to VB having native code compilation, but
with native code compilation, it is no longer true (because native code
compilation does optimize the code just as you say). In all honesty, I never
gave it a whole lot of thought.
Mike
- Next message: Larry Serflaten: "Re: How to write debug utility functions"
- Previous message: MikeD: "Re: How to write debug utility functions"
- In reply to: Duane Bozarth: "Re: Why is "False" = "-1"?"
- Next in thread: Duane Bozarth: "Re: Why is "False" = "-1"?"
- Reply: Duane Bozarth: "Re: Why is "False" = "-1"?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|