home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!wupost!gumby!yale!yale.edu!ira.uka.de!math.fu-berlin.de!unidui!rrz.uni-koeln.de!Germany.EU.net!mcsun!sunic!ugle.unit.no!alf.uib.no!krill!yngvar
- From: yngvar@imr.no (Yngvar Foelling)
- Subject: Re: Typedefing builtin... thanks.
- Message-ID: <1992Nov13.172005.28239@alf.uib.no>
- Sender: yngvar@krill (Yngvar Foelling)
- Organization: Institute of Marine Research, Bergen, Norway.
- References: <1992Nov9.150414.10221@odin.diku.dk> <1992Nov11.061812.21905@sq.sq.com>
- Date: Fri, 13 Nov 92 17:20:05 GMT
- Lines: 32
-
- In article <1992Nov11.061812.21905@sq.sq.com>, msb@sq.sq.com (Mark Brader) writes:
- |> > The major arguments used to justify these techniques were about portability.
- |> > A program is easier to port, when you can change some typedefs in a header
- |> > file, instead of changing a lot of ints to longs all over the code.
- |>
- |> There are good reasons for typedefs, but this is not one of them.
- |> If the code was correctly written, those ints would have been longs
- |> in the first place. See item 10.1 in the FAQ list.
-
- Yes, let's. Particularly the last paragraph:
-
- If for some reason you need to declare something with an _exact_
- size (usually the only good reason for doing so is when
- attempting to conform to some externally-imposted storage
- layout, but see question 17.2), be sure to encapsulate the
- choice behind an appropriate typedef.
-
- In this case, it seems like Jonatan Kutchinsky _was_ trying to match an
- "externally-imposted storage layout". He wanted to simulate a particular
- processor.
-
- Personally, I've used this technique several times, and for similar reasons.
-
- BTW, does anyone know about a C-compiler with 64-bit longs? Even if there
- aren't any right now, it seems to me that one would have to be written to take
- advantage of 64-bit architechtures. In that case, using long instead of int
- would be overkill.
- --
- Yngvar F°lling (yngvar@imr.no)
- Institute of Marine Research
- Bergen
- Norway
-