<quote-correction>
mauri1106: Please ensure to quote the previous reply. This gives a
context to the mail. I've corrected this time.
</quote-correction>
> Anand Wrote:
>
>Here's a snippet from standard:
>"An integer may be converted to any pointer type. Except as previously
>specified, the result is implementation-defined, might not be
correctly >aligned, might not point to an entity of the referenced type,
and might >be a trap representation."
>
>mauri1106 wrote:
>> Dear anand, can you better explain your answer? I don't understand what
>> do you want to say.
>> thanks
>>
I assume you didn't search the archives of this group.
What you have is a void**ptr. So the moment you redirect it you have is
a void* (a pointer) and you are assigning an integer value to it.
And hence the warnings.
"ptr <- integer" is an implementation defined behavior and it's not
guaranteed to work.
Anyway, only valid and portable integer value that can be assigned to
any pointer is 0. (Which is NULL pointer).
If you are trying to assign any other integer to the pointer it purely
depends on your compiler and platform as to how to treat it.
The hard coded integer value you are assigning is purely dependent on
your environment in which the code is going to run.
For all you know you memory location 0x04000 could be invalid (you might
not have access to it).
Or there's no way to represent a memory location using just integers in
your system.
There are times when this may be valid (and in those cases you are very
much aware of it.) But then it's still the duty of your compiler to warn
you.
Now you decide, do you always have access to 0x4000 memory location (if
that's how you refer a location in your system) is valid and you have
full rights and doesn't cause any problem in that particular system.
--
(Welcome)
http://www.ungerhu.com/jxh/clc.welcome.txt
(clc FAQ)
http://www.eskimo.com/~scs/C-faq/top.html