Underlying type's implicit conversion of the shift operators

Moderators: david ward, misra cpp

Post Reply
chill
Posts: 1
Joined: Fri Jul 19, 2019 11:32 am
Company: SourceBrella

Underlying type's implicit conversion of the shift operators

Post by chill » Fri Jul 19, 2019 12:49 pm

Is there a implicit conversion in shift expressions?
The underlying type of the result is the underlying type of the shift-expression.

Code: Select all

int8_t i8;
uint8_t u8;
uint32_t u32;
int32_t i32;

u32 + i8; // i8 -> u32
u32 += i8; // i8 -> u32

u32 << i8; // ?
i8 << u32; // ?

u32 <<= i8; // i8 -> ?
i8 <<= u32; // ?


Post Reply

Return to “6.5 Expressions (C++)”