Erik de Castro Lopo wrote:

O Plameras wrote:

Many books in C programming teaches that 64-bit machines have 8 bytes int size, at least the ones I gone through.

I have never personally seen such a book.


What did you say about Basic Data Types in your book as it is essential
to know and differentiate between these types ? and as C is closely bound
to hardware architecture you must have said something about these data
types as it relates to 16-bit/32-bit/64-bit ?

I have not gone through your book that you co-authored. Did you or your book say anything about int sizes in relation to
machine architecture ? And what did you say there ? I'm curious ?

I wrote a program like your sizeof program (but including sizeof(void*))

Well that's good idea. I was writing for myself and I always assume the pointer must cover the whole range of possible addresses, 2 exp (32-1) - 1 in 32-bit; and 2 exp (64-1) -1 in 64-bit. And so sizeof (void *) is sort of "understood you". But we just learned the authors of C programming books as well as CPU manufacturers don't necessarily agree with each other in terms of what they say and what they
make. We must check first-hand, no problem there.

And, also, in that case I should also include "sizeof(unsigned)" which in C programming is usually the same as sizeof(int). But we learned again that we must satisfy ourselves
first hand.

and showed the output on a 32 bit x86 Linux machine and a 64 bit Alpha Linux machine. The sizes of all data types other than long and void*
were the same.

Erik


--
O Plameras
http://www.acay.com.au/~oscarp/tutor

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to