On Thu, Feb 25, 2010 at 2:47 PM, Benjamin Scott
<[email protected]> wrote:
> --- On Wed, 2/24/10, Tyler Littlefield <[email protected]> wrote:
>> Benjamin Scott <[email protected]> wrote:
>>
>> > Just curious, but why would the compiler
>> > knowing the value of a pointer be pointless?
>
>> It doesn't know the value *at* the
>> pointer, nor the value it points to, unless your using a
>> statement to assign/check. The pointer points to an address,
>> so the compiler doesn't really know the value unless it's
>> assigned, or unless it's a constant in some cases.
>
> Okay, I got it: Since the compilier is not
> Intelligent, then it can't know anything.
> Now how does that apply to my first statement?
How does it not? (presuming I've managed to cull the correct quote
from the mess that is people's inability to quote properly on here)
> If a Pointer has the value of 0, then it SHOWS
> the compilier that it points to nothing.
>
> Isn't KNOWS and SHOWS different? I thought
> SHOWS doesn't mean understanding, but knows
> definely does.
0 is one of the few _exceptions_ (as are explicit constants used in,
for example, placement new and/or hardware addresses.)
Given the following program:
#include <stdio.h>
int main(void){
int i;
printf("%p\n", &i);
}
How can the compiler possibly know, at compile time, what the value
printed will be? And even if it did, what use could the compiler make
of it?
--
PJH
http://shabbleland.myminicity.com/env
http://www.chavgangs.com/register.php?referer=9375