compiler construction - Byte precision pointer arithmetic in C when sizeof(char) != 1 -


How can a portable single byte pointer with precision accuracy?

Note that:

  • Four is not 1 byte on all platforms
  • sizeof (zero) == 1 is available as an extension only in GCC
  • Although some platforms may have Pointer Dareb Pointer alignment restrictions, arithmetic can still be compared to the minimum basic POD type size Better granularity may be required

your impression error Ipuarn is - sizeof (char) defined is to be the first everywhere. Out of section 6.5.3.4 ("size operator"):

(para 2)

Size of operator operator (bytes) in your Operand, which can be an expression or some type of parenthesis.

(para 3)

Type four, unsigned char, or signed four, (or its eligible version) result1.

When they move together, it becomes clear that in C, whatever size there is, this size is a "byte" (even if it is more than 8 bits , On some platforms)

A char is therefore the smallest addressable type if you need to know in small units from char , at the same time Char to read and use bitwise operators four which you want.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -