[fpc-devel] Semicolon before else

Juha Manninen juha.manninen at phnet.fi
Fri Jan 29 10:22:58 CET 2010

>        What are you doing?  Get to work.
>        Compiling.
>        Oh, ok.

Right, It was a forced social break with C compilers on old computers.
When you were really in a creative mood then it ate lots of your time and 
energy. When the compiler finished your idea was maybe gone and you had to 
catch up with it again.
Then I got spoiled with Delphi. Lazarus / FPC is little slower but still fast 

>> Anyway, there are some weird cases when it's difficult to
>> tell which IF the ELSE belongs to.

> That's neither intuitive nor friendly to me.  But if it works for you and 
> makes your programming better, then I'm glad you came up with it.

My idea here was that always if there are nested IFs and some ambiguity, one 
should use BEGIN END blocks.
In simple cases the compiler could accept the semicolon (but also accept the 
old syntax without semicolon as the proposed patch does). That would be 

I didn't come up with the patch, it was Aleksa Todorovic.
BTW, why doesn't the example code compile in current FPC?
I remember such code compiled in Delphi but I am not sure and I don't have 
Delphi now to check.

Anyway, this is a rather small thing. Most challenges in programming are 
somewhere else than in the use of a semicolon.

Juha Manninen

More information about the fpc-devel mailing list