Steve Teixeira and Xavier Pacheco have formidable reputations as Delphi
authorities and I'm curious about this quotation (I haven't read the Delphi
4 developers guide):
> OBJECT PASCAL
> Parenthesis
> There shall never be white space between an open parenthesis and the next
> character. Likewise, there shall never be white space between a closed
> parenthesis and the previous character. The following example illustrates
> incorrect and correct spacing with regard to parentheses:
>
> CallProc( AParameter ); // incorrect
> CallProc(AParameter); // correct
> Never include extraneous parentheses in a statement. Parentheses should
only
> be used where required to achieve the intended meaning in source code. The
> following examples illustrate incorrect and correct usage:
>
> if (I = 42) then // incorrect - extraneous parentheses
> if (I = 42) or (J = 42) then // correct - parentheses required
I'd like to know the context in which it was written. Is this part of a
coding style specification? If not it sounds like "thou shalts" delivered
from on high.
As I understand it, extraneous parentheses may cause the compiler a little
extra work to evaluate the expression, but is not "incorrect" per se. If
I'm correct on that point, then it comes down to coding style. Similarly
for the white space between a closed parenthesis and the previous character.
I believe the compiler ignores whitespace.
Did the authors state the reasons for their directives?
I come from the "let the compiler do the work" school, so my opinion is that
anything that makes code more understandable is "correct".
Bob Osborn
Osborn Software Design Ltd
Phone:(03) 3883552
Mailto:[EMAIL PROTECTED]
----- Original Message -----
From: James Sugrue <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: 16 June 2000 01:57
Subject: RE: [DUG]: Strange compiler error
> I'm not saying trying to turn this into "I'm right your wrong" thing,
> because it comes down to personal preference I guess, but here is what I
was
> talking about, taken from Delphi 4 Developers Guide by Steve Teixeira and
> Xavier Pacheco.
>
> <SNIP>
>
> OBJECT PASCAL
> Parenthesis
> There shall never be white space between an open parenthesis and the next
> character. Likewise, there shall never be white space between a closed
> parenthesis and the previous character. The following example illustrates
> incorrect and correct spacing with regard to parentheses:
>
> CallProc( AParameter ); // incorrect
> CallProc(AParameter); // correct
>
> Never include extraneous parentheses in a statement. Parentheses should
only
> be used where required to achieve the intended meaning in source code. The
> following examples illustrate incorrect and correct usage:
>
> if (I = 42) then // incorrect - extraneous parentheses
> if (I = 42) or (J = 42) then // correct - parentheses required
>
> </SNIP>
>
>
> -----Original Message-----
> From: Patrick Dunford [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 15 June 2000 19:15
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Strange compiler error
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > Behalf Of James Sugrue
> > Sent: Thursday, 15 June 2000 14:14
> > To: Multiple recipients of list delphi
> > Subject: RE: [DUG]: Strange compiler error
> >
> >
> > Works fine for me.
> >
> > BTW You do realise you can have
> >
> > if MessageDlg('Are you sure you want to delete this
book?',mtConfirmation,
> > [mbYes,mbNo],0) = mrNo then
> > abort;
> >
> > I think I have also read somewhere that it is not recommended to
> > encase the
> > if statements in () if you can help it. I am open for verification on
that
> > one though.
>
> I think you are wrong.
>
> The coding style I have used is based on one that is designed to improve
the
> clarity of coding. I am not a C programmer.
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
>
>
> CAUTION - This message may contain privileged and confidential information
intended only for the
> use of the addressee(s) named above. If you are not the intended
recipient of this message you are
> hereby notified that any use, dissemination, distribution or reproduction
of this message is prohibited.
> If you have received this message in error please notify Progressive
Enterprises Ltd. immediately via
> email at [EMAIL PROTECTED] Any views expressed in
this message are those of the
> individual sender and may not necessarily reflect the views of Progressive
Enterprises Ltd.
>
> This footnote also confirms that Progressive Enterprises Ltd. has swept
this email message for the
> presence of computer viruses. This does not guarantee this message is
virus free.
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz