int difference(unsigned a,unsigned b) {return abs(a-b);}
This can go very wrong because of unsigned integer arithmetic... need abs((int)a-(int)b)!


Specifically, 2-3=4294967295

Web 0 0 0
Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!