There is a project option to enable this. Look up "Boolean short-circuit
evaluation" in the help files or the {$B+} switch.

Delphi by default short-circuits boolean evaluation so in your example
will stop as soon as it gets a true value in the Result variable.

You can switch this off forcing it to evaluate the whole expression,
i.e. always call the CheckAccount function but this may be confusing to
other Delphi developers.

I would go with restructuring the loop if you definitely want
CheckAccount called each time.



Michael Darling
Senior Solutions Developer
ROOM Solutions Ltd
mailto:[EMAIL PROTECTED]


-----Original Message-----
From: Wilfried Mestdagh [mailto:[EMAIL PROTECTED] asked:

>What happens here is that as soon as 1 CheckAccount returns True then
it stop calling CheckAccount. I solved this with increment a counter for
each CheckAccount and Result := Counter > 0; But this kind of
optimization is for me a bug, or is it not ?  I discoverd this in D7,
dont know about previous D versions, however I'm pretty sure I did
similar things in other projects.
*******************************************************************
CONFIDENTIALITY NOTICE/DISCLAIMER
This email and any attachments are confidential, protected by 
copyright/intellectual property rights and may be legally privileged. The 
information transmitted is intended only for the person or entity to which it 
is addressed.  If you are not the intended recipient, dissemination or copying 
of this email is prohibited.
If you have received this in error, please notify us by forwarding this email 
to the following address: [EMAIL PROTECTED] , and then delete the email 
completely from your system.
This email and any attachments have been scanned for computer viruses by a 
market leading anti-virus system. However, it is the responsibility of the 
recipient to conduct its own security measures. No responsibility is accepted 
by ROOM Solutions Limited for loss or damage arising from the receipt or use of 
this email and any attachments.
No responsibility is accepted by ROOM Solutions Limited for personal emails.
ROOM Solutions Ltd, http://www.roomsolutions.net
********************************************************************
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to