Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Optional warning for octal numbers #24017

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR24018
Status NEW
Importance P enhancement
Reported by Olaf van der Spek (olafvdspek@gmail.com)
Reported on 2015-07-02 06:26:49 -0700
Last modified on 2015-07-24 02:45:28 -0700
Version unspecified
Hardware PC Windows NT
CC dgregor@apple.com, ditaliano@apple.com, geek4civic@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
People don't expect 010 == 8 to be true. People rarely use octal numbers, the
most frequent (only?) use case appears to be POSIX file permissions. People do
sometimes prefix decimal numbers with a 0 by mistake..
Could you add an optional warning for such cases?
Quuxplusone commented 9 years ago

Not sure how this warning should look like, and where/why we should warn.

Quuxplusone commented 9 years ago

Can you please provide examples?

Quuxplusone commented 9 years ago
0 is currently the only prefix for octal numbers so it should warn for every
octal number (if this warning is enabled).

int a = 0010;
int b = 070;