strange for me ?

while im just take alook at stdlib (I start refreash my knowlege in c latly) , I found this
Code:
cutoff = neg ? (unsigned long)-(LONG_MIN + LONG_MAX) + LONG_MAX
while
-(LONG_MIN + LONG_MAX) +LONG_MAX = -LONG_MIN
why it is not like this
Code:
cutoff = neg ? (unsigned long)-LONG_MIN
is there any meaning to this operation
the version in this link seem correct
http://www.koders.com/c/fid0A9B008CA98BE77AEC5E59AFC19BECAE325AC60F.aspx
but src code in my machine for freebsd is look like the first code
 
None of the code you pasted is valid. You are missing else operator.

Did you mean:

Code:
cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;

Meaning if "neg" flag is not zero set cutoff to -LONG_MIN if it is zero set it to LONG_MAX.
Both definitions are found in limits.h.
 
thanks

thanks for replay im just wondering
while this
Code:
cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
equal to
Code:
cutoff = neg ? (unsigned long)-(LONG_MIN + LONG_MAX) + LONG_MAX : LONG_MAX;
why the second used in stdlib implementation in freebsd?
is
Code:
-(LONG_MIN + LONG_MAX) + LONG_MAX
is signature or something or it related to c ? or just to make diffrent from gnu implementation any help ?
 
Back
Top