Re: NULL vs 0 vs 0L bikeshed time

From: Bruce Evans <bde_at_zeta.org.au>
Date: Tue, 2 Mar 2004 17:14:18 +1100 (EST)
On Mon, 1 Mar 2004, Stefan Farfeleder wrote:

> On Mon, Mar 01, 2004 at 09:58:28PM +0000, Mark Murray wrote:
> > Stefan Farfeleder writes:
> > > On Sun, Feb 29, 2004 at 03:46:35PM +0000, Mark Murray wrote:
> > >
> > > > -#define        NULL    0L
> > > > +#define        NULL    (0L)
> > >
> > > What's the point of parenthesizing 0L?
> >
> > Its two lexical elements. I got into the habit of doing that when a
> > macro replacement bit me some years ago. It is a very unimportant part
> > of the patch. :-)
>
> While I agree that it's quite unimportant, I have to contradict you.
> `OL' is a pp-number which is converted to an integer-constant in
> translation phase 7 according to the C standard.  It always is a single
> token.

Understanding pp-numbers and transaltion phases is unecessary for this.
Quoting small parts of section 6.4:

    token:
	...
	constant
	...
    constant:
	integer-constant
	...
    integer-constant:
	decimal-constant integer-suffix-opt
	...

So the suffix is part of the token for integer constants.

pp-numbers and translation phases, whatever they are, must be consistent
with this.  For tokens, I think this just means that every C token is a
pp-token.

Bruce
Received on Mon Mar 01 2004 - 21:14:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:45 UTC