by Pxtl · 13y ago · 0 comments
The problem presented in the article is not well thought out and cannot be achieved with these instructions:
Write down your name.
Make a pile of pennies with as many pennies as there are letters in your name.
Keep doing this:
Write down an 'X'
Remove one of the pennies
as long as the number of pennies is less than the number of letters in your name.
So, outside of being a mind-reader how is a C++ compiler supposed to correct _your_ thinking?int foo = -1 unsigned int bar = 1
then "foo > bar" evaluates true. And it shouldn't, because that makes no sense. Languages should not violate the Principle of Least Surprise unless there's a really good reason.
Personally I always use -Wextra (the relevant flag for clang) when working on my own code.