E
Eric Lilja
Hello, I have a few global variables in my program. One of them holds the
name of the application and it's defined in a header file globals.hpp (and
the point of definition also happen to be the point of declaration of this
variable, correct?):
static const char * g_application_name = "Tiny, class-based MDI Example";
In another source file, I'm including the header globals.hpp and I'm using
the variable g_application_name. I do, however, get the following warning
when building my program:
globals.hpp:12: warning: 'g_application_name' defined but not used
This warning is repeated for every file that includes globals.hpp, either
directly or indirectly.
However, if I change the type of g_application_name to const char * const,
the warning disappears.
So I guess that the proper way to define a global string variable that is
not to be written, only read, and should be shared for all source files is
to the define it with the type const char * const?
/ Eric
name of the application and it's defined in a header file globals.hpp (and
the point of definition also happen to be the point of declaration of this
variable, correct?):
static const char * g_application_name = "Tiny, class-based MDI Example";
In another source file, I'm including the header globals.hpp and I'm using
the variable g_application_name. I do, however, get the following warning
when building my program:
globals.hpp:12: warning: 'g_application_name' defined but not used
This warning is repeated for every file that includes globals.hpp, either
directly or indirectly.
However, if I change the type of g_application_name to const char * const,
the warning disappears.
So I guess that the proper way to define a global string variable that is
not to be written, only read, and should be shared for all source files is
to the define it with the type const char * const?
/ Eric