You're still allowed to do this, of course:
Code:// x.hpp
extern const int &x;
// x.cpp
int real_x;
const int &x = real_x;
Printable View
You're still allowed to do this, of course:
Code:// x.hpp
extern const int &x;
// x.cpp
int real_x;
const int &x = real_x;
As I said, both files at the same time and -combine:
Code:gcc -o const -combine const1.c const2.c
You can't use gcc to compile c++ programs. I see that I did .c instead of .cpp, sorry about that.
Both gcc and g++ gave me "unrecongized option `-combine`". Changing cout to printf and compiling both as C gave me a working program.
IMO it is pretty silly to have that be undefined behavior but oh well.
Yes, you can. And it was me who changed the names to .c, because -combine is not implemented for C++.Quote:
You can't use gcc to compile c++ programs.
I don't know what GCC version you have. Mine is 4.1.2.
3.something. Haven't had a need to update it. When I compiled the files using gcc I got syntax errors because of std::.
#macros are beautiful
so sweetCode:#define IF if(
#define THEN ) {
#define ENDIF }
#define MARRY_GO_ROUND while(1) {;}
Code:IF 5 == 5 THEN
MARRY_GO_ROUND
ENDIF