For Programmers: Free Programming Magazines  


Home > Archive > VC STL > August 2005 > Why do namespaced enum and struct have to be static?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Why do namespaced enum and struct have to be static?
ultranet

2005-08-29, 7:03 pm


namespace abc {

static enum Buttons {
a = 0,
b,
c
} abcButton;

static struct {
unsigned short de;
unsigned short f;
} defButton;

W/o static, the 2 defintions above were causing redefinition errors. I find
that strange, cause they were declared outside a class. Making them static
doesn't make them unusable from other files either. So what does it signify?
ultranet

2005-08-29, 7:03 pm

Never mind:
it's because there are variables following type declaration.

static can be removed, if only types are declared.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com