🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #241

Re: Bug in users command

#241
From: Norman Diamond
Date: Thu, 24 Jan 1991 06:01
22 lines
1620 bytes
In article <1991Jan24.004044.13362@craycos.com> pmk@craycos.com (Peter Klausler) writes:

>Given the declaration
>	char (*a)[N];
>the expressions
>	(char *) a
>	&((*a)[0])
>	*a
>are all valid in ANS X3.159-1989, all of type "char *", and all yield pointers
>to the same char object.

No.  The last two yield pointers to the same char object, the first char in *a.

The first one coerces a pointer-to-array to a pointer-to-char value.
The standard guarantees that you can take a pointer-to-something, cast it to
a pointer-to-char, cast it back to a pointer-to-something, and the result is
equivalent to the original pointer.  It does not guarantee that the value
with type pointer-to-char can actually be used for anything.

--
Norman Diamond       diamond@tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Technical Details
Message-ID: <1991Jan24.060113.22461@tkou02.enet.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!bloom-beacon!deccrl!news.crl.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!jit345!diamond
References: <6182:Jan2222:06:3991@kramden.acf.nyu.edu> <18981@rpp386.cactus.org> <12360:Jan2320:15:5291@kramden.acf.nyu.edu> <1991Jan24.004044.13362@craycos.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!bloom-beacon!deccrl!news.crl.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!jit345!diamond
From: diamond@jit345.swstokyo.dec.com (Norman Diamond)
Newsgroups: comp.bugs.4bsd,comp.std.c
Subject: Re: Bug in users command
Message-ID: <1991Jan24.060113.22461@tkou02.enet.dec.com>
Date: 24 Jan 91 06:01:13 GMT
References: <6182:Jan2222:06:3991@kramden.acf.nyu.edu> <18981@rpp386.cactus.org> <12360:Jan2320:15:5291@kramden.acf.nyu.edu> <1991Jan24.004044.13362@craycos.com>
Sender: news@tkou02.enet.dec.com (USENET News System)
Reply-To: diamond@jit345.enet@tkou02.enet.dec.com (Norman Diamond)
Organization: Digital Equipment Corporation Japan , Tokyo
Lines: 22