Pointer incrementation and assignme
Gary L. Randolph
randolph at ektools.UUCP
Fri Jun 2 22:36:45 AEST 1989
In article <236100012 at mirror> root at mirror.TMC.COM writes:
-The compiler knows the size of the data that you are working with.
-a+=1 and a = a+1 will still increment the pointer by 2.
-The same way the compiler knows how to increment ints, floats, longs,
-and doubles, it knows how to correctly increment any pointer, no matter
-what the syntax that you use.
-In reality
What is 'reality'
-the command a++ is just shorthand for a+=1 and a = a+1. It was origionally
Things are never this simple at deeper levels.
-made for lines like:
-
- whatchamacallit = whatchamacallit + 1;
-
-Carnigan and Ritchie were programmers who didn't like to type.
^^^^^^^^?
I SERIOUSLY doubt that two brilliant minds (*Kerninghan* and Ritchie)
included such a feature because they don't like to TYPE. Perhaps you
are confusing this with the fact that 'type' was something the original
C tended to ignore. There have been many pleas lately to keep the S/N
ratio down. Let's not waste $$$$. (My past does not make me a saint :->)
I recall, from my PDP 11 assembler days, two addressing modes;
autoincrement and autodecrement. I believe that something of this nature
had *much* more to do with the post and preincrement/decrement operators
than did K&R's typing skills.
Gary
More information about the Comp.lang.c
mailing list