What does "expected unqualified-id before numeric constant" mean?

A

Allen

In my app, there is a namespace definition.

....
namespace CMD {
...
const int YT_UP = 1; // line 149
...
};

g++ tells expected unqualified-id before numeric constant error at
line 149.
I change it to be

namespace CMD {
...
const int YT_UP1 = 1; // line 149
...
};

It compiles ok.

So is there name collision for YT_UP?
 
B

Bo Persson

Allen wrote:
:: In my app, there is a namespace definition.
::
:: ...
:: namespace CMD {
:: ...
:: const int YT_UP = 1; // line 149
:: ...
:: };
::
:: g++ tells expected unqualified-id before numeric constant error at
:: line 149.
:: I change it to be
::
:: namespace CMD {
:: ...
:: const int YT_UP1 = 1; // line 149
:: ...
:: };
::
:: It compiles ok.
::
:: So is there name collision for YT_UP?

Probably.

All uppercase names are often used for preprocessor macros, which
doesn't respect namespace scopes. Therefore such names should
generally be avoided for everything else.



Bo Persson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top