Hi, Wolfgang Lux wrote:
Well, you've missed out the one that should have worked:-) -2147483648LL Note that suffix L mark a long value, which is just 32 bits on a 32-bit system the long type. So to get a 64-bit literal you need to ask for a long long value.
ah yes! At first I didn't think of it because LL is not in the K&R book I have. I tested that afterwards... however I think the other solution I propose is somehow "smarter" not rerquiring to use a bigger type, since we need to do a comparison and not just represent the absolute value.
I myself find it confusiong that "-123" is not the literal, but it is essentially "0" - "123", I would have expected to be able to really represent a negative number if I have a signed type. This is not specified in K&R but is an explanation which explains well the whole thing. Maybe with a paarenthesis or some other notation I'd like to be able to directly represent that number. The "trick" of (-2147483647 -1) is nasty but works :-)
Riccardo