Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!zinn!mem From: mem@zinn.MV.COM (Mark E. Mallett) Newsgroups: comp.os.minix Subject: Re: Minix/ST problems. Summary: Do not make sizeof(anything) assumptions Message-ID: <397@zinn.MV.COM> Date: 30 Oct 88 18:04:31 GMT Article-I.D.: zinn.397 References: <249@cstw01.UUCP> <2598@sultra.UUCP> Reply-To: mem@zinn.MV.COM (Mark E. Mallett) Organization: Zinn Computer Co., Litchfield NH Lines: 29 In article <2598@sultra.UUCP> dtynan@sultra.UUCP (Der Tynan) writes: >Hmmm. I've always been partial to the idea that sizeof(char *) == sizeof(int). >In fact, I've seen a lot of code (not necessarily my own), which assumes this. >If one needs sizeof(int) == 16, then use short. It's my belief that if you >have a true 32-bit address space (lucky you), then there's no reason to keep >ints to a small size. Of course it doesn't matter what you're partial to your what you're beliefs are, what matters is the language definition and the compiler implementation. The only assumption you should make about an int is that it is a size that is optimally handled by your hardware, and sometimes that assumption is at the whim of the compiler writer. If you really need to make assumptions -- any assumptions -- about the size and class of your declarations and their modifiers, use typedefs and/or defines to devise your own metatypes, and use those metatypes where storage characteristics must match some predetermined criteria. > Of course, one should always use casts with NULL anyway. One should only have to use casts with NULL if NULL is improperly defined, and even then using the cast won't necessarily help you. -mm- -- Mark E. Mallett Zinn Computer Co/ PO Box 4188/ Manchester NH/ 03103 Bus. Phone: 603 645 5069 Home: 603 424 8129 uucp: mem@zinn.MV.COM ( ...{decvax|elrond|harvard}!zinn!mem ) BIX: mmallett