Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!amdcad!lll-crg!gymble!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: RE: type cast in initializer Message-ID: <2992@umcp-cs.UUCP> Date: Sat, 1-Feb-86 21:26:04 EST Article-I.D.: umcp-cs.2992 Posted: Sat Feb 1 21:26:04 1986 Date-Received: Mon, 3-Feb-86 05:30:39 EST References: <2124@brl-tgr.ARPA> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 19 In article <2124@brl-tgr.ARPA> art@acc.arpa writes: > The initializer [for > int x = 0; char *ptr = (char *) &x; > ] should be legal if x is static, but not necessarily if x is > declared as an auto. If x is auto, the compiler could place it in > a register whose address cannot be taken. The compiler can only do this if (1) it can take the address of a register (a la Pyramid) or (2) it has determined that nowhere is the address actually taken. The compiler MUST NOT make `&var' illegal when `var' was not declared `register'. Another way to look at this is that `register' is not really a `hint to the compiler' about using a machine register, but rather a `promise to the compiler' that the programmer will not take the address of the variable. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu