Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hcrvx1.UUCP Path: utzoo!hcr!hcrvx1!tom From: tom@hcrvx1.UUCP (Tom Kelly) Newsgroups: comp.lang.c Subject: Re: Some questions about ANSI C Message-ID: <1531@hcrvx1.UUCP> Date: Mon, 17-Aug-87 09:32:54 EDT Article-I.D.: hcrvx1.1531 Posted: Mon Aug 17 09:32:54 1987 Date-Received: Wed, 19-Aug-87 01:35:53 EDT References: <497@houxs.UUCP> <165600007@uiucdcsb> <6265@brl-smoke.ARPA> Reply-To: tom@hcrvx1.UUCP (Tom Kelly) Organization: HCR Corporation, Toronto Lines: 70 Summary: In article <6265@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes about the latest ANSI C meeting. I was at the meeting in Paris, so perhaps I can provide some context to the discussion. The setjmp() issue arose because of a public comment from Symbolics, Inc. On this machine, it is possible to generate the code for setjmp() inline at the point of call, but it is not possible for the setjmp() function to determine the necessary information about its caller. Thus, setjmp() cannot be implemented as a function on this machine. Since setjmp() was a function, it was possible to take the address of it, and invoke it via a pointer. This led to an impossible situation for the commentor. The suggestion was to make it illegal to take the address of setjmp(), so that the compiler would always know when it was being invoked. The committee felt this was a reasonable request, and that it was unlikely that very much present or future code would be seriously harmed by the inability to manipulate setjmp() as an ordinary function. As far as the aliasing issue: A question arose (from various public comments, including one from Stallman) regarding legal aliasing. Boiled down to the essentials, given: double *dp; int *ip; *ip = 1; *dp = 3.0; Can the compiler deduce after these two statements that *ip has not been changed, and still contains 1? The change to the standard is intended to make it so the answer is yes. It sets out the cases in which object references can refer to the same object and the compiler must still get "the right answer." Because of various aspects of the C language, and common programming practice, certain special cases had to be provided in that aliasing in these cases is permitted. The struct case arises as follows: struct tag { int i; double d; char c; } s, t; double *dp; dp = &(s.d); *dp = 3.0; s = t; *dp ? Although *dp and s have different types, it was felt that this kind of aliasing was legal and common. The language in the proposal is meant to ensure that a compiler has to get this one right, while not being required to worry about aliasing in the first example. Hope this has helped. Tom Kelly (416) 922-1937 HCR Corporation, 130 Bloor St. W., Toronto, Ontario, Canada {utzoo, ihnp4, decvax}!hcr!tom