D
David Mathog
size_t varies from system to system. This occasionally leads to
coding issues such as:
(void) sprintf(msg,"length of buffer: %d",strlen(msg));
which worked fine on a 32 linux but triggered errors with gcc
on an X86_64 system. (Ok, it should probably have been a %u rather
than a %d, but since msg was always going to be short it didn't
affect the program's execution.)
The gcc printf man page indicates that "%zu", "%zx", etc. tell the
compiler that the variable has type size_t, whatever size_t happens to
be. Is "z" part of the C standard or is it a gcc extension? If the
former, at what point did "z" become part of C?
Thanks,
David Mathog
(e-mail address removed)
coding issues such as:
(void) sprintf(msg,"length of buffer: %d",strlen(msg));
which worked fine on a 32 linux but triggered errors with gcc
on an X86_64 system. (Ok, it should probably have been a %u rather
than a %d, but since msg was always going to be short it didn't
affect the program's execution.)
The gcc printf man page indicates that "%zu", "%zx", etc. tell the
compiler that the variable has type size_t, whatever size_t happens to
be. Is "z" part of the C standard or is it a gcc extension? If the
former, at what point did "z" become part of C?
Thanks,
David Mathog
(e-mail address removed)