(unsigned)-1

Kenneth R. Ballou ballou at brahms.Berkeley.EDU
Sat Dec 20 17:02:06 AEST 1986


In article <800 at nscpdc.NSC.COM> djg at nscpdc.NSC.COM (Derek J. Godfrey) writes:
>In article <5460 at brl-smoke.ARPA>, gwyn at brl-smoke.ARPA (Doug Gwyn ) writes:
>[original poster?]

	Your attribution is incorrect.  It is I who wrote that argument.

>>Actually, I think (unsigned) -1 does have to give you a bit pattern of
>>all 1's.
>
>Enough! The C language conserns itself with the syntax and semantics
>of its programs, not its pragmatisms(these are the concerns of compiler
>writers and hackers :-) .)

	I am afraid I do not understand the preceding sentence.  What are
'pragmatisms' of a language?  C must specify the behavior of any syntatically
correct program.  There are, of course, details which C leaves to the
implementer and machine, but that these are not defined must be specified by
the language.

>	Firstly "all ones" is compiler/machine dependant - solveable
>		if you know or can anticipate the representation
>		of numbers made by your compiler.
>		( 2's comp -1, mostly ~0, always #define ALL1S 0x????? )

	Again, might I restate that the argument makes no assumption about
how *signed* integers are represented?  Point 1 asserts that *unsigned*
integers must be represented in straight binary notation.

>	Secondly but more importantly what semantics do you attribute
>	to "all ones?"

	Tell me if I am missing something, but I interpret "all ones" to be
what to me is obvious:  a region of memory all of whose bits are 1.

>		         this should dictate how to represent it. ( a
>	collection of bits fields, a range a numbers (2^n -1 ) a
>	combination of masks, or whatever.)

	Again, I do not understand your point.  Could you please offer a
clarification?

--------
Kenneth R. Ballou			ARPA:  ballou at brahms
Department of Mathematics		UUCP:  ...!ucbvax!brahms!ballou
University of California
Berkeley, California  94720



More information about the Comp.lang.c mailing list