[Gllug] Pointer arithmetic with void *
Tethys
tet at accucard.com
Wed Aug 14 15:15:06 UTC 2002
Just curious. Does anyone know what the C standard says about pointer
arithmetic with void *? for example:
void *ptr;
ptr = mmap(NULL, 1024, PROT_READ, MAP_SHARED, fd, 0);
ptr++;
Where is ptr pointing? 1 byte from the start of the file? One
"pointer length" (i.e., 4 or 8 bytes from the start of the file)?
Something else entirely?
Empirical evidence shows it to be a 1 byte increment on Linux and
Solaris, but can this be relied upon, or is it just an implementation
detail of gcc (which I used on both)? K&R doesn't say either way, and
I don't want to be making assumptions that may prove non-portable.
Does anyone have the ISO C specs to confirm it one way or the other?
Tet
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list