D
dizzy
Hello
I have noticed a strange behavior (tho for many of you this is to be
expected I'm sure
) when I have an expression that adds a long
value with an unsigned one (like in "10l + 10u").
On 32bit platforms (where unsigned can represent more than long) the
result is of unsigned long type while on 64bit platforms the result is
of long time.
Usually in my coding experience I've learned that when writing bool
expressions like "a - 10 < b" I should better write them "a < b + 10"
because somehow I thought this keeps the expressions to their original
types (I thought "b + 10" will have the type of "b") and then the case
of comparing signed to unsigned values depends if a and b were mixed
signed types. It seems that was false.
Can someone point me to the relevant standard section that
allows/requires that behavior described above?
Thank you!
I have noticed a strange behavior (tho for many of you this is to be
expected I'm sure
value with an unsigned one (like in "10l + 10u").
On 32bit platforms (where unsigned can represent more than long) the
result is of unsigned long type while on 64bit platforms the result is
of long time.
Usually in my coding experience I've learned that when writing bool
expressions like "a - 10 < b" I should better write them "a < b + 10"
because somehow I thought this keeps the expressions to their original
types (I thought "b + 10" will have the type of "b") and then the case
of comparing signed to unsigned values depends if a and b were mixed
signed types. It seems that was false.
Can someone point me to the relevant standard section that
allows/requires that behavior described above?
Thank you!