cushon / issues-import

0 stars 0 forks source link

Octal literals, e.g. 'int i = 010;' are arguably evil #227

Open cushon opened 9 years ago

cushon commented 9 years ago

Original issue created by kevinb@google.com on 2014-01-16 at 07:09 PM


I just finished swearing up and down that the integer literal 010 would equal ten, not eight. How embarrassing.

If we have managed to get the 'l' suffix error to work, it might be worth considering a check that forbids all octal literals as well.

cushon commented 9 years ago

Original comment posted by cgdecker@google.com on 2014-01-16 at 09:57 PM


They're kind of useful when converting between numeric POSIX file permissions and other formats, though I admit that's very much an edge case.

cushon commented 9 years ago

Original comment posted by eaftan@google.com on 2014-03-04 at 12:52 AM


We found many legitimate uses of octal literals for file permissions, and many illegitimate uses for dates. We could possibly special case the checker to allow octal literals that are passed into file-permission-accepting methods.


Status: Accepted Labels: -Priority-Medium, Priority-Low