Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sdd.hp.com!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!kth.se!cyklop.nada.kth.se!news From: d88-jwa@dront.nada.kth.se (Jon W{tte) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW C int size Message-ID: <1990Nov18.103115.24170@nada.kth.se> Date: 18 Nov 90 10:31:15 GMT References: <1278@ucl-cs.uucp> <505@nitrex.UUCP> Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 20 In article hanche@imf.unit.no (Harald Hanche-Olsen) writes: >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 The printf ( "%ld" , ( long ) sizeof ( int ) ) ; should work. If it's unsigned or signed doesn't matter, since the result very seldom is > 8 ( or negative :-) h+ h+@nada.kth.se "Moof!(tm)"