Wilson Yeung wrote:
I don't know of a portable representation of a byte other than a char.
 And while no one promises that a char is really a byte, I expect that
too much code would break and so it would be many many years before
this is changed in practice.

c++ *guaranties* that char is always one byte. It cannot be anything else. The difference is that from c++ point of view byte is not limited to 8 bits (it could be more, but not less). Not sure about c, but I expect it be the same


Likewise, no one promises that sizeof(int) == 4, but vendors haven't
changed this to 8 on 64 bit platforms either, opting instead to use
"long long" or "long int".

Why would you think that sizeof(int) is 4?? It's only happens to be so on your machine/compiler. It only says that sizeof(int) is at least 2 bytes. Sizeof(long) at least 4... (AFAIK)



AFAIK there's nothing wrong with using void *, and most of the C
runtime functions like malloc use this.  C++, however, explicitly
disallows pointer arithmetic on a void *, so if you're programming in
C++, you may end up casting to a char * anyway.

For me pointer arrifmetic on void* makes no sense. How is the address of the next void should be calculated (pvoid + 1) without knowing size of void???


Reply via email to