I want to pass the sign changed version of some value to a function. I know how to check for overflow if the sign changes however I don't know about this one case.
int apple( int );
int a = 0;
apple( -a );
Is that defined behavior covered by the C/C++ standard? I'm passing -0 I would guess when a == 0. What about using something like this instead: a ? -a : a
? Thanks