Skip to main content
5 events
when toggle format what by license comment
Mar 17, 2021 at 12:40 history edited Toby Speight CC BY-SA 4.0
Missing word
Mar 17, 2021 at 8:35 comment added Peter Cordes I was curious what exactly would happen with negative args to std::toupper. According to en.cppreference.com/w/cpp/string/byte/toupper, If the value of ch is not representable as unsigned char and does not equal EOF, the behavior is undefined.. So a value sign-extended to a negative int would indeed cause UB. A plausible implementation of toupper (on a system with 8-bit char) could be using the int to index a 257-char lookup table, with the [-1] index having something for EOF=-1. More-negative indices could even go off into an unmapped earlier page.
Mar 16, 2021 at 23:56 comment added Occhima Thank you ! That is a really subtle problem, i need to study more on the data structures/tpyes that c++ provides. as close friend said to me: "C++ gives you enough rope to hang yourself" you need to know how to use the language correctly
Mar 16, 2021 at 17:53 history edited Toby Speight CC BY-SA 4.0
added 825 characters in body
Mar 16, 2021 at 17:46 history answered Toby Speight CC BY-SA 4.0