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: Rob Landley
Subject: Re: [Tinycc-devel] More fun with comparison between pointer and integer...
Date: Wed, 5 Sep 2007 13:36:11 -0500
User-agent: KMail/1.9.6

On Wednesday 05 September 2007 5:27:46 am Gregg Reynolds wrote:
> 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.

Yup.  Not how to fix it yet, but I might have time to bang on that this 
evening...

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

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