Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.lang.c Subject: Re: "the integer constant zero" Message-ID: <1032@mcgill-vision.UUCP> Date: 8 Apr 88 08:26:17 GMT References: <570@mtxinu.UUCP> <10747@mimsy.UUCP> <7507@brl-smoke.ARPA> <10754@mimsy.UUCP> Organization: McGill University, Montreal Lines: 33 In article <10754@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > [ char *p; p = (0, 0); ] > [...] the integer constant `0' in a pointer context [...]. 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 integer constant zero" is not necessarily the same as "an integer constant expression zero". It seems to me that the phrase could reasonably be taken to indicate that only `0', standing alone, was sufficient. I think I could make a case that even putting parentheses around it would break it. Does dpANS specify exactly what they mean by "the integer constant zero"? For example, p=0; assigns a nil pointer to p (assuming a pointer type for p). Does the draft make it clear whether p=0+0; also does? The RHS is a constant expression with value zero, but this is not necessarily the same thing as "the [note definite article] integer constant zero". Now, how about #define FIRST 0 char foo[10]; char *p; p = &foo[FIRST] - &foo[0]; /* now waiiiit a minute.... */ That's constant expression whose value is a zero integer, isn't it? Is this wrong or just questionable style? der Mouse uucp: mouse@mcgill-vision.uucp arpa: mouse@larry.mcrcim.mcgill.edu