On 2009-11-04, Rick DeNatale <rick.denatale / gmail.com> wrote: > Why this wierd semantic? Because it the original use case was for > pointers rather than integers, and it goes back to C originating > originally as a kind of high level assembly language for the DEC > PDP-11 which had postincrement and predecrement addressing modes used > for stepping through strings or arrays. Apparently apocryphal -- the increment usage predates the PDP 11 port of C. (Interestingly, there's now a ton of sources repeating the story, but so far as I know, the canonical answer from Ritchie and Thompson was that the increment operator predates C proper, and thus the PDP 11 work.) > Because pre-ANSI C allowed easy spoofing/overlay of types, it also > worked for integers and was used in contexts like for loops > for(i = 0; i < max;i++) It is not because of spoofing or overlay of types that this worked, but because the operator's defined for all types. > If you want the real semantics of the C/C++ post-increment operator, > I'm afraid you'll have to look for it in a C family language, not an > object reference semantic language like Ruby. This part, though, I totally agree with. It's not coherent to imagine a ++ operator, especially a postincrement, working in a Ruby-like language. -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam / seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!