Talk:Sizeof

From Wikipedia, the free encyclopedia

When you discuss sizeof you make reference to sizeof telling you the number of octets something is. this is not correct, an octet refers to an 8 bit byte, but not all platforms have this (e.g. some machines on the old PDP line), all sizeof is in units of sizeof(char) which is defined to be 1, you have to use limits.h to look at CHAR_BIT to see the number of bits in the byte...so I think this article should be changed to remove the references to octets as they are not portable, and replace them with the word byte or even character, also the example which does a sizeof(c) where c is a char is only a good example if you are demonstrating that sizeof(char) is always defined to be 1 --Michael Lynn 02:34, 2 November 2006 (UTC)

Changed to (hopefully) incorporate the best of both worlds :) (i.e. sizeof(char) is always 1 and sizes are in terms of bytes) Conor H. 02:19, 6 November 2006 (UTC)
That pretty much fixes the parts I was concerned with, thanks --Michael Lynn 08:32, 6 November 2006 (UTC)