Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: int32 et al. Message-ID: <14917@smoke.brl.mil> Date: 21 Jan 91 21:17:57 GMT References: <1991Jan19.185101.27554@odi.com> <14905@smoke.brl.mil> <1991Jan21.135216.23447@odi.com> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 29 In article <1991Jan21.135216.23447@odi.com> benson@odi.com (Benson I. Margulies) writes: >In article <14905@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes: >>But you didn't address the problems I pointed out, for example the >>complete lack of ANY type whose size if precisely 32 bits in some >>implementations. >Well, if we ever hit such a beast, there's always >typedef char [4] int32; You mean typedef char int32[4]; however, that is much worse than simply using long, because array types don't behave the same as integral types and all sorts of havoc is likely to ensue. >The system include files contain >extern int blahblah (int, char *); >I don't control that declaration. If I call blahblah with a long, >the compiler bleats a warning. As well it should! Assuming that there is no useful information in the high-order part of the long, you should simply cast it to int when passing it to the blahblah() function; if there IS significant information, then the blahblah() function is inappropriate anyway. >for >extern int quux (int *); >if I pass a long * I get an error, not just a warning. Again, if sizeof(int)==sizeof(long) you can simply use a cast. Otherwise, you need to write a bit of extra code, but that is unavoidable.