[fpc-pascal] ++ and --

Bernd Oppolzer bernd.oppolzer at t-online.de
Tue Jul 30 20:14:20 CEST 2013


Am 30.07.2013 18:20, schrieb Mark Morgan Lloyd:
>
>> Now specifically to your question - I believe that one of the reasons 
>> may
>> be the fact that Pascal does not support unary arithmetic operators in
>> postfix notation. The fact that C allows using them with both prefix and
>> postfix notation makes them even more difficult from my point of view
>> because potentially allowing them only in one of the notations known 
>> from
>> other languages would immediately trigger users to ask why only one of
>> possible notations (common elsewhere) is supported and the other not.
>
> I've got a vague recollection that some of the ++ and -- semantics are 
> particularly unpleasant, and that one of the C inventors did his best 
> to disown them. At least += etc. are fairly unambiguous: they're 
> almost macro expansions and as such they don't mandate any extra 
> overloadable operators etc.
>

FWIW:

the += etc. assignment operators make sense IMO,
because for complex expressions involving array indices etc.
that are to be incremented or decremented, it is no more necessary
to write them twice.

Compared to that, the difference between ++ and += 1
(with ++ you have to put parantheses around the expression to be 
incremented !!)
seems unimportant.

And, if that's a matter for you: the newer PL/1 compilers
support += etc., but don't support ++ and --,

Kind regards

Bernd





More information about the fpc-pascal mailing list