[Oberon] INC(i) vs i := i + 1
dsar at eml.cc
Wed May 5 00:50:55 CEST 2021
On Tue, May 4, 2021, at 10:59 PM, Jeff Maggio wrote:
> [...] Even if they end up using INC(i) down the road, INC(i) isn't necessarily self-explanatory for a novice user without assembly experience *(like me for example)*.
> It's a small consideration though - I was mostly curious if they are compiled differently
Every Pascal trained guy know very well what INC() does and this procedure isn't usually introduced with an assembly background but as a shortend for i := i + 1 (that is longer to type, especially if the variable is longer than "i").
I would have said - without Pascal experience :-)
My explanation of INC() was targeted to advanced programmers for a deeper understanding, especially if you read Pascal-oriented compilers books or advanced Pascal programming books. Pascal compilers are simple and fast and often is better to use a procedure or function that emits a particular asm code instead of using complicated techniques to parse an expression. I guess most Pascal programmers aren't aware of this.
Of course modern optimizing compilers emit the inc opcode in the case of i := i + 1, but with INC() you are sure of that in every Pascal compiler.
More information about the Oberon