Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #698

Re: [OT] Re: Why would one use += 1 at the place of ++?

Date 2011-05-19 07:35 -0700
From Patricia Shanahan <pats@acm.org>
Newsgroups comp.lang.java.help
Subject Re: [OT] Re: Why would one use += 1 at the place of ++?
References <8762p7upgn.fsf@merciadriluca-station.MERCIADRILUCA> <4t6Bp.534$pi2.511@newsfe11.iad> <ir30ui$jok$1@dont-email.me>
Message-ID <veSdnZd_-OsAt0jQnZ2dnUVZ_oudnZ2d@earthlink.com> (permalink)

Show all headers | View raw


On 5/19/2011 5:03 AM, Eric Sosman wrote:
> On 5/19/2011 6:40 AM, David Lamb wrote:
>> [...]
>> I think ++ exists only because the hardware on which C was developed had
>> an addressing mode that did it atomically in the very special case of
>> referring to
>> something = array[index++];
>
> FWIW, some guy named Dennis Ritchie says this is not true.
>
> "People often guess that [++ and --]were created to use the
> auto-increment and auto-decrement address modes provided
> by the DEC PDP-11 on which C and Unix first became popular.
> This is historically impossible, since there was no PDP-11
> when B was developed."
>
> "B" is the language from which C inherited ++ and --, and much else.
>

There seem to me to be two reasons for the ++ and -- operators in C.
Typing was slow and inconvenient when C was invented, so there was a
motivation to make code terse. C made extensive use of macros that could
represent expressions but not statements, so much was done as side effects.

I do not understand why those operators exist in Java. They cannot be
used without going against style advice in the JLS and Java is not a
terse language.

Patricia

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Why would one use += 1 at the place of ++? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-05-19 09:19 +0200
  Re: Why would one use += 1 at the place of ++? Bent C Dalager <bcd@pvv.ntnu.no> - 2011-05-19 10:22 +0000
  Re: Why would one use += 1 at the place of ++? David Lamb <dalamb@cs.queensu.ca> - 2011-05-19 06:40 -0400
    Re: Why would one use += 1 at the place of ++? Jeff Higgins <jeff@invalid.invalid> - 2011-05-19 07:58 -0400
    [OT] Re: Why would one use += 1 at the place of ++? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-19 08:03 -0400
      Re: [OT] Re: Why would one use += 1 at the place of ++? Patricia Shanahan <pats@acm.org> - 2011-05-19 07:35 -0700
        Re: [OT] Re: Why would one use += 1 at the place of ++? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-19 22:57 -0400
          Re: [OT] Re: Why would one use += 1 at the place of ++? rossum <rossum48@coldmail.com> - 2011-05-20 11:00 +0100
          Re: [OT] Re: Why would one use += 1 at the place of ++? Patricia Shanahan <pats@acm.org> - 2011-05-20 12:55 -0700
      Re: [OT] Re: Why would one use += 1 at the place of ++? David Lamb <dalamb@cs.queensu.ca> - 2011-05-19 17:58 -0400
        Re: [OT] Re: Why would one use += 1 at the place of ++? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-19 23:13 -0400
    Re: Why would one use += 1 at the place of ++? Lew <noone@lewscanon.com> - 2011-05-19 08:43 -0400
  Re: Why would one use += 1 at the place of ++? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-19 07:51 -0400
  Re: Why would one use += 1 at the place of ++? Jeff Higgins <jeff@invalid.invalid> - 2011-05-19 08:03 -0400
    Re: Why would one use += 1 at the place of ++? Lew <noone@lewscanon.com> - 2011-05-19 08:08 -0400
  Re: Why would one use += 1 at the place of ++? Roedy Green <see_website@mindprod.com.invalid> - 2011-05-19 10:23 -0700
    Re: Why would one use += 1 at the place of ++? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-05-19 21:15 +0200
      Re: Why would one use += 1 at the place of ++? Lew <noone@lewscanon.com> - 2011-05-19 15:29 -0400

csiph-web