tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] More fun with comparison between pointer and integer.


From: Gregg Reynolds
Subject: Re: [Tinycc-devel] More fun with comparison between pointer and integer...
Date: Wed, 5 Sep 2007 05:27:46 -0500

On 9/5/07, Rob Landley <address@hidden> wrote:
> On Wednesday 05 September 2007 1:02:03 am Dave Dodge wrote:
> > > I fixed the "ptr || ptr" bit not working (check hg), and I just made it
> > > stop warning me about "comparison between pointer and int" for && and ||,
> > > but now it's saying "initializer element not constant".
> >
> > Well looking at 6.6, I'm having a hard time figuring out how to fit
> > the above into one of the described forms of "constant expression".
> > It's the use of pointers at all that causes the problem; most of the
> > ways of defining such expressions seem to be constrained to using only
> > arithmetic types.
>
> It's a pointer to a constant string.  It's in a read-only section of memory.
> More to the point, the or is testing whether or not it's nonzero, so the
> actual _value_ of the pointer goes away and all we need to retain is that it
> wasn't NULL.

Well, the source does say

/* XXX: better constant handling */
static void expr_eq(void) {

which calls:
/* XXX: fix this mess */
static void expr_lor_const(void)

...

So you've probably discovered why.

-g




reply via email to

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