Re: pointer to void property



"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
.



Relevant Pages

  • Re: pointer to void property
    ... > What a typing mess... ... The OP's original question was: ... Can this p-to-char be used to access the representation of the ...
    (comp.lang.c)
  • Re: Singles to Doubles
    ... May even abandon the "rounding" once we've demonstrated comparability. ... I've been sticking w/ the original question of trying to keep the appearance of the external data consistent with that previously output by the system. ... because what we see in base 10 representation is not the same as what actually gets processed in base 2 representation. ... I find it fascinating that we are naturally biased to the base 10 version of numbers, and floating point calculations force us to confront the fact that it is just one of many possible bases. ...
    (microsoft.public.vb.general.discussion)
  • Re: pointer to void property
    ... >> What a typing mess... ... > The OP's original question was: ... > Can this p-to-char be used to access the representation of the ...
    (comp.lang.c)