Skip to content

Instantly share code, notes, and snippets.

@Ratstail91
Created February 24, 2015 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ratstail91/754b249f89fb484194d0 to your computer and use it in GitHub Desktop.
Save Ratstail91/754b249f89fb484194d0 to your computer and use it in GitHub Desktop.
Strangely, GCC 4.8.1 doesn't really handle namespaces properly?
#include <iostream>
#include "name.hpp"
namespace test {
void printVar() {
std::cout << var << std::endl;
}
void setVar(int i) {
var = i;
}
int getVar() {
return var;
}
}
#include <iostream>
#include "name.hpp"
int main(int, char**) {
test::printVar();
test::setVar(50);
std::cout << test::getVar() << std::endl;
std::cout << test::var << std::endl;
return 0;
}
#pragma once
namespace test {
namespace {
int var = 0;
}
void printVar();
void setVar(int i);
int getVar();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment