Path: utzoo!utgpu!water!watmath!clyde!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.lang.c Subject: Re: Of Standards and Inventions: A Cautionary Tale Message-ID: <40@lakart.UUCP> Date: 8 Apr 88 20:06:13 GMT References: <10949@mimsy.UUCP> Organization: Lake - The systems people Lines: 27 From article <10949@mimsy.UUCP>, by chris@mimsy.UUCP (Chris Torek): > First, a note about unsignedness: In the C language, the unsigned > attribute on a type can be viewed as `sticky': operations on unsigned > numbers always yeild an unsigned result. (The only exception is the > ternary e1?e2:e3, whose result is independent of the type of e1.) > The condition can, of course, be cleared by a cast to a signed > type. I throw this into the wind as food for thought. If nobody likes the idea, that is all fine and dandy, but I find it a sometimes useful system. I am in the process of implementing a language in the likes of BCPL and B, i.e. variables are typeless. HOWEVER, what I did was to type the appropriate operators: so -2 / 2 == -1 (signed) -2 ./ 2 == 32767 (unsigned) (16 bit implementation) The ./ is the unsigned divide, similarly .> is unsigned greater etc. etc. Thoughts anyone? -- dg@lakart.UUCP - David Goodenough +---+ | +-+-+ ....... !harvard!adelie!cfisun!lakart!dg +-+-+ | +---+