Re: {$ELSEIF} not working in Delphi 2006 ?
- From: "Skybuck Flying" <spam@xxxxxxxxxxx>
- Date: Wed, 18 Oct 2006 22:44:22 +0200
"Nicholas Sherlock" <N.sherlock@xxxxxxxxx> wrote in message
news:eh5sd1$v3g$1@xxxxxxxxxxxxxxxxxx
Skybuck Flying wrote:
{$ELSEIF B}
'B' is not a conditional expression. You probably mean:
{$IFDEF A}
writeln('A');
{$ELSEIF DEFINED(B)}
writeln('B');
{$ELSEIF DEFINED(C)}
writeln('C');
{$ELSE}
writeln('?');
{$IFEND}
Ok,
Now I understand how these things work.
"$IF" expects a conditional expression which should return true.
"$DEFINE A" is not a boolean, it's only a symbol.
"$IFDEF" is a special kind of if statement which only tests for symbols to
be present.
"$ELSEIF" works like the "$IF" but is still allowed to be mixed with
"$IFDEF".
"$ELSEIFDEF" is missing.
There are two ways to end a conditional directive:
"$IFEND" and "$ENDIF"
Apperently one should look at the last conditional directive and use the
correct one (?!).
All in all it's pretty messed up.
I would remove $IFDEF and "$ENDIF" to clean this mess up ;)
Why was "$IFDEF" added anyway ? Were they too lazy to type "$IF DEFINED(X)"
? Sounds like a typical C (compiler) programmer to me !?
Also there is no other "$END".
So I would simply rename "$IFEND" to "$END"... no need to make things extra
fucked up. Delphi uses "END" why wouldn't compiler directives use "$END" ;)
Well maybe that's to prevent confusing with normal delphi code... but then
again "$IF" could also be confusing so that would again be inconsistent.
Bye,
Skybuck.
.
- Follow-Ups:
- Re: {$ELSEIF} not working in Delphi 2006 ?
- From: Nicholas Sherlock
- Re: {$ELSEIF} not working in Delphi 2006 ?
- References:
- {$ELSEIF} not working in Delphi 2006 ?
- From: Skybuck Flying
- Re: {$ELSEIF} not working in Delphi 2006 ?
- From: Nicholas Sherlock
- {$ELSEIF} not working in Delphi 2006 ?
- Prev by Date: Re: Detecting WIN32 or .NET example in a compiler directive
- Next by Date: Re: {$ELSEIF} not working in Delphi 2006 ?
- Previous by thread: Re: {$ELSEIF} not working in Delphi 2006 ?
- Next by thread: Re: {$ELSEIF} not working in Delphi 2006 ?
- Index(es):