[Top][All Lists]
[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: |
Thu, 6 Sep 2007 00:55:56 -0500 |
User-agent: |
KMail/1.9.6 |
On Wednesday 05 September 2007 6:29:04 pm Rob Landley wrote:
> On Wednesday 05 September 2007 6:17:38 pm Rob Landley wrote:
> > Hang on, so when char *a is constant, (int)a is _not_ constant?
> >
> > How does that work?
>
> Looking back at it, I think what the standard means is since the actual
> address of the char * is supplied by the linker, than despite it being a
> run-time constant it can't be known at compile time.
>
> However, we can know that it's nonzero which is all && and || need, so I
> can teach _them_ about propogating constant values from pointers.
Which I have now done: &&, ||, and == NULL all resolve constant arguments at
compile time.
In theory, it could also compare equality for two constants at compile time
even when neither of them is null, but in practice the nonzero value is an
index into the symbol array thingy, and that means if you compare "thursday"
== (char *)4 there would be a possibility of a false positive, and I'm just
not going there right now. :)
> Rob
Still Rob
--
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.
- [Tinycc-devel] More fun with comparison between pointer and integer..., Rob Landley, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Dave Dodge, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Rob Landley, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Dave Dodge, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Rob Landley, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Dave Dodge, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Rob Landley, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Rob Landley, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Simon 'corecode' Schubert, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer...,
Rob Landley <=
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Dave Dodge, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Rob Landley, 2007/09/06
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Dave Dodge, 2007/09/06
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Gregg Reynolds, 2007/09/05
- Re: [Tinycc-devel] More fun with comparison between pointer and integer..., Rob Landley, 2007/09/05