Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!WSL.DEC.COM!hania From: hania@WSL.DEC.COM Newsgroups: comp.windows.x Subject: Re: Xtk "unsigned int" typedefs considered harmful Message-ID: <8809131742.AA06973@gilroy.pa.dec.com> Date: 13 Sep 88 17:42:56 GMT References: <8809131658.AA03210@EXPO.LCS.MIT.EDU> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 22 >> The point is that having Dimension, et.al., typedef'd as unsigned ints >> has no redeeming virtue whatsoever >Yes they do. They are unsigned because things that are Dimensions are >cardinal in nature. And herein lies the problem: many people think of the C type "unsigned" as "cardinal". This is a mistake. There is no "cardinal" type in C. The best way to think of "unsigned" is as a bit field; the only examples of the use of "unsigned" that I can find in Kernighan and Richie use them in that capacity. In addition, there is no type-checking done on "unsigned" values, to make sure that they are positive, as one would expect for "cardinal" types. These are all arguments that "unsigned" should never be used in C to mean "cardinal"; such use is, at best, misleading. I believe that at least some of the toolkit implementers believe that it was a mistake to have things like Dimension typedef'd as unsigned. The best the rest of us can do is agree. Hania