--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
Sadly, that doesn't help because the preprocessor will mangle those names before the compiler ever sees it.
Daniel
Namespaces won't help, since macros don't respect scoping.
A rename would certainly solve the immediate problem, but it's not clear what a better name would be: the enum is DomCode, and KEY_A, KEY_B, etc are very reasonable names for enumerators.
On Mon, Dec 28, 2015 at 6:49 PM, Daniel Cheng <dch...@chromium.org> wrote:Namespaces won't help, since macros don't respect scoping.Can we avoid using macros to define all this stuff?
A rename would certainly solve the immediate problem, but it's not clear what a better name would be: the enum is DomCode, and KEY_A, KEY_B, etc are very reasonable names for enumerators.DOM_KEY_A? KEY_CODE_A?
PK
On Mon, Dec 28, 2015 at 6:50 PM Peter Kasting <pkas...@chromium.org> wrote:On Mon, Dec 28, 2015 at 6:49 PM, Daniel Cheng <dch...@chromium.org> wrote:Namespaces won't help, since macros don't respect scoping.Can we avoid using macros to define all this stuff?It's not a macro defined by Chromium code that's the problem: it's (many) macros from a system header (in this case, <linux/input.h>) that conflict with names that Chromium code also uses.
A rename would certainly solve the immediate problem, but it's not clear what a better name would be: the enum is DomCode, and KEY_A, KEY_B, etc are very reasonable names for enumerators.DOM_KEY_A? KEY_CODE_A?That seems arguably worse to me, but that's just bikeshedding =)
According to https://google.github.io/styleguide/cppguide.html#Enumerator_Names, SHOUTY_CASE was recommended until Jan 2009 and because of exactly the problem dcheng@ brought up here, it was changed to prefer kCamelCase (ie new code should prefer kCamelCase).I assume that the naming change that is being discussed internally mostly deals with enum classes, since I think it would be kind of hazardous to change the names for regular enums (ie enum Foo { bar } will collide with anything named bar, whereas enum class Foo { bar } doesn't have that issue). (I might be wrong here, since I could only find partial discussion threads)Waiting for internal discussion to come to a consensus sgtm. But maybe considering loosening the rules around regular enum naming is also worth doing.Just my 2c.
--