Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!nuug!sigyn.idt.unit.no!ugle.unit.no!hanche From: hanche@imf.unit.no (Harald Hanche-Olsen) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW C int size Message-ID: Date: 17 Nov 90 16:27:57 GMT References: <1278@ucl-cs.uucp> <505@nitrex.UUCP> Sender: news@ugle.unit.no Organization: The Norwegian Institute of Technology, Trondheim, Norway. Lines: 21 In-Reply-To: leyser@nitrex.UUCP's message of 16 Nov 90 14:53:25 GMT In article <505@nitrex.UUCP> leyser@nitrex.UUCP (Jeff Leyser) writes: main() { printf("An int is %d bytes\n",sizeof(int)); } Actually, that code isn't portable. What if sizeof() returns a long? It often does. Of course, it is often the case that int == long, so on most compilers you won't notice the difference. I really don't know how to make a piece of code like the above portable, unless you say things like printf("An int is %ld bytes\n",(long)sizeof(int)); Yeah, that should do it. Or should that be unsigned long? Ahhh, the joys of portable programming... - Harald Hanche-Olsen Division of Mathematical Sciences The Norwegian Institute of Technology N-7034 Trondheim, NORWAY