Reliability of having arithmetic shift in c++ when targeting x86 -


so according c++ spec

the value of e1 >> e2 e1 right-shifted e2 bit positions. if e1 has unsigned type or if e1 has signed type , non-negative value, value of result integral part of quotient of e1/2^e2. if e1 has signed type , negative value, resulting value implementation-deļ¬ned.

so it's implementation defined, if i'm using bug-free compiler targetting x86 platform, , im right shifting using signed type, there reason doubt not shift in signed bits? (x86 supports arithmetic shift obviously)

do not confuse "implementation defined" "undefined". "implementation defined" means, literally, "the implementation must define it". it's not random, or should have determine experiment. behavior defined implementation, , standard-conforming implementations document these behavior details (because fail non-conformant in itself). barring implementation bugs, programs faithfully exhibit behavior defined c++ implementation.

whereas cannot rely on undefined behavior, can rely on implementation defined behavior consistent within given c++ implementation. unsafe assume, however, different implementations same hardware define these details same way, or different versions of same implementation consistent in way.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -