c - Left shifting with a negative shift count -


what happens here?

a << -5

obviously doesn't right shift. book i'm reading states:

on 1 machine, expression left shift of 27 bits

my question is; why? causes left shift of 27 bits? , happens when shifting negative shift count? thank you.

negative integers on right-hand side undefined behavior in c language.

iso 9899:1999 6.5.7 bit-wise shift operators §3

the integer promotions performed on each of operands. type of result of promoted left operand. if value of right operand negative or greater or equal width of promoted left operand, the behavior undefined.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -