[fpc-pascal] Changing variable in conditional

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Jan 9 19:12:19 CET 2013


Henry Vermaak wrote:
> On Wed, Jan 09, 2013 at 10:46:54AM +0000, Mark Morgan Lloyd wrote:
>> I've got a vague recollection that since that episode the kernel
>> maintainers have mandated a use of parentheses that helps the
>> compiler pick up the distinction between an equality and an
> 
> Assignment inside if statements are usually frowned upon in the kernel.
> gcc warns if you don't use parentheses, but I usually use parentheses
> for readability, so there's always a danger of making a typo and not
> getting a warning.  Can't remember the last time I've had a bug of this
> sort, but that's probably because I'm extra vigilant with conditionals.
> I think the decision to keep this syntax out of pascal is a good one.

I use C barely at all. In the words of one of the M2 vendors "We come to 
bury C, sir, not to praise it".

If Pascal /had/ to have some sort of multiple assignment, I'd have 
thought borrowing an idea from Perl and doing something like

[a, b, c] := (d = e);

would have been minimally acceptable.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list