Re: pointer to void property
- From: Irrwahn Grausewitz <irrwahn35@xxxxxxxxxx>
- Date: Tue, 13 Sep 2005 08:49:00 +0200
"Old Wolf" <oldwolf@xxxxxxxxxxxxxx> wrote:
>Irrwahn Grausewitz wrote:
>>
>> If it's safe to convert a p-to-sometype to p-to-void, AND it's safe
>> to convert a p-to-void to p-to-char, THEN it's safe to convert a
>> p-to-int to p-to-void to p-to-char.
>>
>> What a typing mess...
>
>The OP's original question was (rephrased):
>
> Can this p-to-char be used to access the representation of the
> "sometype" that p-to-sometype was pointing to?
<snip>
Of course. A pointer-to-charactertype can be used to access the
individual bytes of any object that occupies the memory location
said pointer happens to point to (Ref: C99 6.3.2.3p7).
IIRC OP's question was, if this is still valid when the p-to-char
was not converted directly from the pointer to the original object,
but "went through" a pointer-to-void. It is (Ref: C99 6.2.5p26,
6.3.2.3p1, 6.3.2.3p7).
Aside: in some sense, a pointer-to-void is just a pointer-to-char
in disguise: it shall, as the authors of the standard put it, have
the same representation and alignment requirements.
Best regards
--
Irrwahn Grausewitz (irrwahn35@xxxxxxxxxx)
welcome to clc : http://www.ungerhu.com/jxh/clc.welcome.txt
clc faq-list : http://www.faqs.org/faqs/C-faq/faq/
clc frequent answers: http://benpfaff.org/writings/clc
.
- Follow-Ups:
- Re: pointer to void property
- From: Christopher Benson-Manica
- Re: pointer to void property
- References:
- pointer to void property
- From: aegis
- Re: pointer to void property
- From: Irrwahn Grausewitz
- Re: pointer to void property
- From: aegis
- Re: pointer to void property
- From: Irrwahn Grausewitz
- Re: pointer to void property
- From: Old Wolf
- pointer to void property
- Prev by Date: Re: pointer to void property
- Next by Date: Re: Should use of goto completely avoided in programs?
- Previous by thread: Re: pointer to void property
- Next by thread: Re: pointer to void property
- Index(es):
Relevant Pages
|