code_junkie

Variable declarations in header files - static or not?

Nov 10th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. static const unsigned int VAL = 42;
  2. const unsigned int ANOTHER_VAL = 37;
  3.  
  4. static int TEST = 0;
  5. void test();
  6.  
  7. #include <iostream>
  8. #include "test.h"
  9.  
  10. int main(void) {
  11. std::cout << &TEST << std::endl;
  12. test();
  13. }
  14.  
  15. #include <iostream>
  16. #include "test.h"
  17.  
  18. void test() {
  19. std::cout << &TEST << std::endl;
  20. }
  21.  
  22. const int i = 10;
  23.  
  24. #include "a.h"
  25.  
  26. func()
  27. {
  28. cout << i;
  29. }
  30.  
  31. #include "a.h"
  32.  
  33. func1()
  34. {
  35. cout << i;
  36. }
Add Comment
Please, Sign In to add comment