Le Mar 7, 2008 à 2:54 PM, Jonas Maebe a écrit :


On 03 Mar 2008, at 17:16, Damien Gerard wrote:

In any programs, a lot of tests on empty strings are made.
The following made the work :
if Length(s) <> 0 then ...
or
if s <> '' then ...

In a lot of cases, the real length is no needed, just to know if the string is empty or not.

That is what "if s <> '' then" checks for. This is already generated as optimally as possible.


In a previous thread, I have ask the difference between (Length(s) = 0) and (s = '')

Copy paste a answer :


if s = '' then ...
of this one
if Length(s) <> 0 then ...

Both generate the same code.


Consequently, it can not be the same code. Otherwise I understood nothing :)



--
Damien Gerard
[EMAIL PROTECTED]

"Intelligence is 10 million rules."
   -- Douglas Lenat





_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to