(unsigned)-1

Derek J. Godfrey djg at nscpdc.NSC.COM
Fri Dec 19 14:53:45 AEST 1986


In article <5460 at brl-smoke.ARPA>, gwyn at brl-smoke.ARPA (Doug Gwyn ) writes:
[original poster?]
>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 :-) .)
	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????? )
	Secondly but more importantly what semantics do you attribute
	to "all ones?" 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.)



More information about the Comp.lang.c mailing list