[fpc-devel] Strange behaviour of ;

Florian Klaempfl florian at freepascal.org
Fri Oct 21 09:17:41 CEST 2005


Marc Weustink wrote:

> I can confirm this on linux-i386 2.0.0 and darwin-ppc 2.0.1
> 
> It looks like "+ <some call>" is parsed wrong. The next "program"
> compiles fine.

Well, the compiler/parser thinks you use the unary + operator which it can
safely throw away :) IIRC TP accepted the unary + operator for any expression so
we did.

> 
> Marc
> 
> 
> program testplus;
> {$mode objfpc} {$H+}
> begin
>   + ParamStr(0);
>   + ParamCount;
>   + Exit;
>   + WriteLN;
> end.
> 
> 
> 
> Alexander Todorov wrote:
> 
>> Hi all,
>> i have noticed something strange and I am not sure if this is a bug or
>> a feature.
>> ------------------------
>> strSQL := Copy(strSQL,1,Length(strSQL)-1) + ' WHERE ';
>> strSQL := strSQL ; + ConstructWhereClause;
>> --------------------------^
>>
>> This part of code must construct a sql sttement which is used later on.
>> the function ConstructWhereClause constructs everything that is behind
>> `WHERE`.
>> How ever having a semi-colon not in right place messed things up.
>> The result is the old value of strSQL without the result of
>> ConstructWhereClause.
>> Removing ; before the plus (+) character fixes the problem.
>>
>> In Delphi this would cause a compilation error, but in FPC it does
>> not. Why ?
>>
>> Btw : the miss placed ; appeared because Lazarus' identifier
>> completion adds a ; when the completion is selected. Any comments on
>> this ?
>> _______________________________________________
>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>>
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list