- 121
- 4
int data; data >> 16
is actually undefined behaviorUndefined Behavior. My suggestion, in addition to most of what's already been said, is to stick to unsigned int
s as much as possible in C.
Edit: uppercased Undefined Behaviour again (after someone unhelpfully lowercased it) because it’s a technical term from the standard.
It’s Undefined Behaviour if data is negative, that is.
int data; data >> 16
is actually undefined behavior. My suggestion, in addition to most of what's already been said, is to stick to unsigned int
s as much as possible in C.
int data; data >> 16
is actually Undefined Behavior. My suggestion, in addition to most of what's already been said, is to stick to unsigned int
s as much as possible in C.
Edit: uppercased Undefined Behaviour again (after someone unhelpfully lowercased it) because it’s a technical term from the standard.
It’s Undefined Behaviour if data is negative, that is.
"int data; data >> 16"int data; data >> 16
is actually Undefined Behaviourundefined behavior. My suggestion, in addition to most of what’swhat's already been said, is to stick to unsigned integeraunsigned int
s as much as possible and then some, in C.
"int data; data >> 16" is actually Undefined Behaviour. My suggestion, in addition to most of what’s already been said, is to stick to unsigned integera as much as possible and then some, in C.
int data; data >> 16
is actually undefined behavior. My suggestion, in addition to most of what's already been said, is to stick to unsigned int
s as much as possible in C.