Article View: comp.std.c
Article #3206Re: call to revolt
From: Norman Diamond
Date: Thu, 27 Jun 1991 00:35
Date: Thu, 27 Jun 1991 00:35
30 lines
2040 bytes
2040 bytes
In article <31822@hydra.gatech.EDU> roy@prism.gatech.EDU (Roy Mongiovi) writes:
>I fail to see why the following should be categorically outlawed:
> char *intptr;
> intptr = malloc(sizeof(int));
This is legal.
> read(fd, intptr, sizeof(int));
This is also legal as far as the standard is concerned. If you don't have
a prototype in scope, and size_t is not the same size of integer as read()
expects for its third parameter, then it could fail at execution time.
> *((int *) intptr)++;
OK, if people want ++ to be applicable to non-lvalues, submit your suggestions
to the committee when they call for comments on C-2001 (the successor to
C-1989). For all you people who enjoy doing:
void f(int x) {
x ++;
}
f(n); /* Huh? Why didn't the value of n get bumped? */
f(3); /* Huh? Why didn't my 3 change to 4, like in the bad old
days of Fortran? */
OK, you should also be allowed to say
(n + 13) ++; /* Huh? Why didn't n get bumped? Or should
(n+13) have been bumped? ? */
*((int *) intptr)++; /* Huh? Why didn't intptr get bumped? */
--
Norman Diamond diamond@tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Permission is granted to feel this signature, but not to look at it.
Technical Details
Message-ID:
<1991Jun27.003531.11136@tkou02.enet.dec.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!jit533!diamondReferences:
<rabson.677868220@physics.ubc.ca> <992@baby.and.nl> <4363@uc.msc.umn.edu> <31822@hydra.gatech.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!jit533!diamond From: diamond@jit533.swstokyo.dec.com (Norman Diamond) Newsgroups: comp.std.c Subject: Re: call to revolt Message-ID: <1991Jun27.003531.11136@tkou02.enet.dec.com> Date: 27 Jun 91 00:35:31 GMT References: <rabson.677868220@physics.ubc.ca> <992@baby.and.nl> <4363@uc.msc.umn.edu> <31822@hydra.gatech.EDU> Sender: usenet@tkou02.enet.dec.com (USENET News System) Reply-To: diamond@jit533.enet@tkou02.enet.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 30