lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev cpp portabliity question


From: pg
Subject: Re: lynx-dev cpp portabliity question
Date: Fri, 15 Oct 1999 07:12:00 -0600 (MDT)

In a recent note, T.E.Dickey said:

> Date: Fri, 15 Oct 1999 07:30:47 -0400 (EDT)
> 
> >  What syntax error you are talking about? gcc handles this as expected, the 
> > result is 'x+x' (the ANSI spec says this is a correct behaviour, and most 
> > obvious incorrect behaviour is infinite loop). 
> 
Explain this to me.  I don't have ANSI handy for a few hours, but I'm pretty
sure that when a macro is expanded any macro names found in the expansion
are further expanded, without limit, so the obvious correct behavior is
an infinite loop.

> as given, you have an incomplete statement (what's "x" in this context).
>   
> > > > #define x x+x   
> > > > x   
> 
To pick a nit, there's no requirement that a macro expand to a complete
statement.  Code to complete the statement could exist on lines preceding
and following the fragment, such as:

        (void) (

        #define x x+x   
        x   

        ) ;

but the infinite loop should still happen.

-- gil
-- 
StorageTek
INFORMATION made POWERFUL

reply via email to

[Prev in Thread] Current Thread [Next in Thread]