Xref: utzoo comp.lang.c:8392 comp.unix.questions:6160 Path: utzoo!mnetor!uunet!husc6!purdue!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c,comp.unix.questions Subject: Re: BSD C compiler bug Message-ID: <10754@mimsy.UUCP> Date: 21 Mar 88 18:22:17 GMT References: <570@mtxinu.UUCP> <10747@mimsy.UUCP> <7507@brl-smoke.ARPA> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 34 >In article <10747@mimsy.UUCP> I said [ char *p; p = (0, 0); ] >>The 11 Jan 1988 draft of the dpANS [disallows `,' in] constant >>expressions (p. 56): In article <7507@brl-smoke.ARPA> gwyn@brl-smoke.ARPA (Doug Gwyn) writes: >What do constant expressions have to do with it? Constant expressions have *everything* to do with it! How do you create a nil pointer of type T in C? Answer: put the integer constant `0' in a pointer context (assignment or comparison, or [dpANS] argument to a function that has a prototype in scope). What is `the integer constant 0'? Clearly this is any constant expression whose value is zero and whose type is one of the integral types {char, short, int, long} or their signed or unsigned variants. The expression (0, 0) certainly has the value zero and an integral type, but according to the dpANS, it is not a constant expression. Hence it cannot be `the integer constant zero'; it is merely an integer expression whose value is zero. The situation is thus the same as if one were to write char *p; int zero = 0; p = zero; I have not found anything in the draft standard to contradict this reasoning. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris