This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Do C++ signed types have modulo semantics?


Michael Veksler wrote:


So what does gcc gives for (int) (MAX_INT+1U)? Maybe it is constrained such that (int)(unsigned)a == a For 1's complement the reverse seems to be incorrect: unsigned a= 0xFFFFFFFF; // or was it 0x80000000? assert((unsigned)(int)a == a); // may fail

why are you talking about one's complement in the context of gcc. From implement-c.texi


	@cite{Whether signed integer types are represented using sign and magnitude,
	two's complement, or one's complement, and whether the extraordinary value
	is a trap representation or an ordinary value (C99 6.2.6.2).}

	GCC supports only two's complement integer types, and all bit patterns
	are ordinary values.

please stop considering non 2's complement stuff.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]