Sorry if this is a duplicate or if this is the wrong place to ask for this but I cannot find any instructions on what I should do.
This is my problem:
Earlier today I asked this question about using extern const
in an header file to make my global variables (that can be changed by the implementation) read only to the files that include my header in C and C++.
At the time I started to write it I thought that it was valid because I had managed to compile a test program with GCC where I had extern const int global_variable
in the header file but int global_variable
in the implementation file.
I later started to doubt that it was valid because I had never seen or heard of it before so I asked this question on stackoverflow to make sure.
It turned out that the only reason I got it to compile was because I did not include my header file in my implementation file.
What should I do in this situation? I think my question on programmers.stackexchange
should be deleted but I am not sure.