Coding style question
I am currently about to mode the glyph generation code into a separate class and was thinking about borrowing the header files from mySTEP. There I noticed that Nikolaus already switched over to the new 10.5 style of using NSInteger and NSUInteger instead of int and unsigned int. GNUstep already has these types defined in NSObjCRuntime.h and my question now is, whether we should slowly switch over to use these types in the API definitions? Fred ___ Gnustep-dev mailing list Gnustep-dev@gnu.org http://lists.gnu.org/mailman/listinfo/gnustep-dev
Re: Coding style question
Am 14.04.2008 um 11:29 schrieb Fred Kiefer: [...] the new 10.5 style of using NSInteger and NSUInteger instead of int and unsigned int. GNUstep already has these types defined in NSObjCRuntime.h and my question now is, whether we should slowly switch over to use these types in the API definitions? 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. So, an enhancement over Cocoa would be to get rid of int as well as of NS(U)Integer. With that off my chest, I think moving to NSInteger is better than sticking with int. Undoubtly, one day Apple will start to do things with NSInteger you can't do with the traditional types. Markus [1] Sure, on a given platform, int has a defined size. But GNUstep is meant to be platform independent, isn't it? - - - - - - - - - - - - - - - - - - - Dipl. Ing. Markus Hitter http://www.jump-ing.de/ ___ Gnustep-dev mailing list Gnustep-dev@gnu.org http://lists.gnu.org/mailman/listinfo/gnustep-dev
Re: Coding style question
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 ___ Gnustep-dev mailing list Gnustep-dev@gnu.org http://lists.gnu.org/mailman/listinfo/gnustep-dev