I was in the process of initializing the single member of a structure in my header file.The brace initialization failed because I got the syntax wrong, but that is not the point. The error made me wonder why was I using a structure in the first place, when a single static const global array would do the job just fine, and for the case, I'd dare to say even better; although the static part is questionable since this is a header file. I have to look up how different storage specifiers affect globals in both source and headers.

We are indoctrinated with the idea that global variables are evil, so much that we forget they exist at all. I think this is a mistake. They're a tool in our arsenal, and while is true that if used improperly they can lead to problems and headaches, completely barring their use should not be the answer.

I think a structure's purpose is to group together similar data in a both a logical and practical manner, such that future handling of this data is easier and convenient. I'd argue that creating a structure that contains a single read-only member does not make sense, at least not from an imperative programming point of view. And such in this case, a global variable is warranted, and a better alternative.

What do you guys think?
I welcome the discussion, feel free to change my mind, etc.