Re: pointer conversion



"M" == Malcolm McLean <regniztar@xxxxxxxxxxxxxx> writes:

M> You will be OK. char is always 1 byte. So casting an arbitrary
M> pointer to a char *, adding an exact multiple of the size of
M> the original type, and casting back is guaranteed to preserve
M> alignment.

I am not so sure about that; would you care to cite C&V, please, if
you claim that it's guaranteed by the standard?

Charlton


--
Charlton Wilbur
cwilbur@xxxxxxxxxxxxxx
.



Relevant Pages

  • Re: arbitrary array index range?
    ... Casting an object pointer of another type to unsigned char * in order ... every programmer will have to write a Java or distributed ...
    (comp.lang.c)
  • Re: pointer conversion
    ... char is always 1 byte. ... and casting back is guaranteed to preserve ... It follows directly from paragraph 2 in section 6.5.2.1 and the first ... While the arithmetic is guaranteed to preserve alignment, ...
    (comp.lang.c)
  • Re: Integer and character manipulation
    ... >equivalent to 'unsigned char' or 'signed char'. ... I need to convert an integer into a string. ... I've tried working with casting but as far as I ...
    (comp.lang.c)
  • Re: mb-gcc producing incorrect code ???
    ... No, as far as I know, casting a pointer to int to a pointer to char ...
    (comp.arch.fpga)
  • Re: pointer conversion
    ... M> pointer to a char *, adding an exact multiple of the size of ... M> the original type, and casting back is guaranteed to preserve ... If the original pointer points at an actual object of its ...
    (comp.lang.c)