Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8094

Re: enum escaping keywords

From Philipp Kraus <philipp.kraus@flashpixx.de>
Newsgroups comp.lang.c++
Subject Re: enum escaping keywords
Date 2011-07-22 19:35 +0200
Organization 1&1 Internet AG
Message-ID <j0ccd8$gdh$1@online.de> (permalink)
References <j0c9t4$e8p$1@online.de> <j0cbg0$2519$1@news.ett.com.ua>

Show all headers | View raw


On 2011-07-22 19:19:31 +0200, Balog Pal said:

> "Philipp Kraus" <philipp.kraus@flashpixx.de>
>> I create a enum type with language codes like:
>> enum lang {
>> en,
>> it,
>> de,
>> asm,
>> or
>> }
>> 
>> but some codes are keywords (asm, or). How can I escape them, so that I 
>> can use them like
>> lang::or or lang::asm ?
> 
> Those are reserved words. You can not use them as identifiers. chose a 
> different form like Asm, asm_, l_asm, ...

Is there no other solution !? Because the language codes are defined in 
the ISO 639, so I would like to use the defined
codes as a enum value. I wouldn't create a own value

Thx

Phil

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

enum escaping keywords Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-22 18:52 +0200
  Re: enum escaping keywords "Balog Pal" <pasa@lib.hu> - 2011-07-22 19:19 +0200
    Re: enum escaping keywords Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-22 19:35 +0200
      Re: enum escaping keywords Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-22 13:52 -0400
  Re: enum escaping keywords James Kanze <james.kanze@gmail.com> - 2011-07-22 13:02 -0700
  Re: enum escaping keywords "James" <no@spam.invalid> - 2011-07-22 16:37 -0700

csiph-web