Re: int8_t lives matter

2023-12-23 Thread Jonathan Wakely via Gcc
On Fri, 22 Dec 2023, 22:04 Andrew Pinski via Gcc, wrote: > On Fri, Dec 22, 2023 at 1:54 PM Olavi Esker via Gcc > wrote: > > > > Hello, > > > > #include > > #include > > > > int main() > > { > > std::int8_t myInt{65}; > > myInt += 1; > > std::cout << myInt; > > } > > > > Guess what this returns

Re: int8_t lives matter

2023-12-22 Thread Andrew Pinski via Gcc
On Fri, Dec 22, 2023 at 1:54 PM Olavi Esker via Gcc wrote: > > Hello, > > #include > #include > > int main() > { > std::int8_t myInt{65}; > myInt += 1; > std::cout << myInt; > } > > Guess what this returns? > Character "B". > > int main() > { > std::int8_t myInt{}; > std::cin >> myInt; > std::co

int8_t lives matter

2023-12-22 Thread Olavi Esker via Gcc
Hello, #include #include int main() { std::int8_t myInt{65}; myInt += 1; std::cout << myInt; } Guess what this returns? Character "B". int main() { std::int8_t myInt{}; std::cin >> myInt; std::cout << myInt; } This will also read a character, and print the characters ascii value. So if I give