Maybe a silly question, but today I've faced this type-generic code:
float f_u( unsigned T v ) { if ( v == 0u ) { return 0.0f; } ... return result; }
Is unsigned-suffix u really needed in this case?
unsigned-suffix
u
In other words: what can possibly go wrong without using u?
UPD.
C
C++
actual problem
f_s()
signed T v
if ( v == u )
f_u()
f_x()
2.1m questions
2.1m answers
60 comments
57.0k users