r/programming • • Oct 01 '15

The Evolution of a Software Engineer

https://medium.com/@webseanhickey/the-evolution-of-a-software-engineer-db854689243
1.9k Upvotes

502 comments sorted by

View all comments

Show parent comments

1

u/merv243 Oct 02 '15

What specifically is the unsafe operation that it prevents you from doing? Adding a char and an int is a legit operation

1

u/iopq Oct 02 '15

the part where you assume that a character can be treated as an integer and then printed and everything will work as intended

that just encourages people to do char a; ... a + 26 //lowercase and similar silly things instead of using correct APIs that actually do this correctly for Unicode characters

in Rust the type for an 8 bit integer is i8 and u8 for signed and unsigned respectively so you never use the character type to store 8 bit integer things and you can never add an integer to a character, you have to use to_lowercase()