Of Standards and Inventions: A Cautionary Tale

David Goodenough dg at lakart.UUCP
Sat Apr 9 06:06:13 AEST 1988


>From article <10949 at mimsy.UUCP>, by chris at 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 at lakart.UUCP - David Goodenough		+---+
							| +-+-+
	....... !harvard!adelie!cfisun!lakart!dg	+-+-+ |
						  	  +---+



More information about the Comp.lang.c mailing list