gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coding style question


From: Tim McIntosh
Subject: Re: Coding style question
Date: Mon, 14 Apr 2008 10:59:32 -0500

On Apr 14, 2008, at 9:56 AM, Markus Hitter wrote:
Well, I'm still stunning why people prefer variable types of undefined size[1] (int, NSInteger, etc.) over those with defined size (int16, int32, int64, etc.). To my understanding of coding, one should always care about the size of variables, ruling out types of undefined size. Additionally, ideal code compiles and works on a 16 bit platform just as good as on a 128 bit platform, without conditional code or similar clutches.

Generally, I think one should care about the minimum guaranteed range of variables, not the exact size. The exact size should only be important if one needs to rely on the overflow or modulo properties of the type, or perform I/O using a machine-independent network packet or file format. Using exact-sized types in cases where it is not necessary is over-specification, and may produce suboptimal code in some situations.

At least as of C99, C specifies minimum ranges to be supported by the built-in types (see 5.2.4.2 Numerical Limits). I'm not sure if this was true prior to C99.

-Tim





reply via email to

[Prev in Thread] Current Thread [Next in Thread]