🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4998

Re: Initializing a variable in terms of itself

#4998
From: Norman Diamond
Date: Tue, 09 Apr 1996 02:44
22 lines
1543 bytes
In article <4k65h6$dfe@nntp.crl.com>, tmcd@crl.com (Timothy A. McDaniel) writes:
>In article <KANZE.96Apr2171323@slsvgqt.lts.sel.alcatel.de>,
>James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de> wrote:
>>The variable is declared, and available for use, as soon as
>>the compiler sees the `=' sign.

>So     void *x = &x;
>would be legal, then, and x would point to itself?

Yes.

>(Or would it have to be     void *x = (void *) &x;    ?)

There is no difference between your two versions.  Conversions either way
between a pointer to object type (including a pointer to incomplete type)
and a pointer to void are allowed implicitly and are identical to conversions
obtained from explicit casts.
--
 <<  If this were the company's opinion, I would not be allowed to post it.  >>
"I paid money for this car, I pay taxes for vehicle registration and a driver's
license, so I can drive in any lane I want, and no innocent victim gets to call
the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
Technical Details
Message-ID: <4kciur$l9l@usenet.pa.dec.com>
Path: arc1-ca.pugleaf.net!tbj.dec.com!diamond
References: <4jpj9l$ik9@cnn.Princeton.EDU> <KANZE.96Apr2171323@slsvgqt.lts.sel.alcatel.de> <4k65h6$dfe@nntp.crl.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!tbj.dec.com!diamond
From: diamond@tbj.dec.com (Norman Diamond)
Newsgroups: comp.std.c
Subject: Re: Initializing a variable in terms of itself
Date: 9 Apr 1996 02:44:43 GMT
Organization: Digital Equipment Corporation Japan , Tokyo
Message-ID: <4kciur$l9l@usenet.pa.dec.com>
References: <4jpj9l$ik9@cnn.Princeton.EDU> <KANZE.96Apr2171323@slsvgqt.lts.sel.alcatel.de> <4k65h6$dfe@nntp.crl.com>
Reply-To: diamond@tbj.dec.com (Norman Diamond)
NNTP-Posting-Host: jit533.tbj.dec.com