|
From: | Simon 'corecode' Schubert |
Subject: | Re: [Tinycc-devel] More fun with comparison between pointer and integer... |
Date: | Thu, 06 Sep 2007 01:33:27 +0200 |
User-agent: | Thunderbird 1.5.0.12 (X11/20070604) |
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.
Actually it is the implicit comparison to NULL which can propagate the constant and || and && then turn can operate on this constant, producing a constant result in the end.
cheers simon
[Prev in Thread] | Current Thread | [Next in Thread] |