-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSharing.cpp
More file actions
39 lines (32 loc) · 933 Bytes
/
Sharing.cpp
File metadata and controls
39 lines (32 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// cppcheck-suppress-file [unreadVariable]
#include <iostream>
using namespace std;
#include "external/constants.h"
#include "inline/constants.h"
#include "internal/constants.h"
namespace InternalWay {
void run() {
std::cout << InternalConstants::avogadro << "\n";
}
} // namespace InternalWay
namespace ExternalWay {
void run() {
std::cout << ExternalConstants::avogadro << "\n";
}
} // namespace ExternalWay
namespace InlineWay {
void run() {
std::cout << InlineConstants::avogadro << "\n";
}
} // namespace InlineWay
struct SharingGlobalConstantsAcrossMultipleFilesngAutoRunner {
SharingGlobalConstantsAcrossMultipleFilesngAutoRunner() {
cout << "\n"
<< "\n"
<< "SharingGlobalConstantsAcrossMultipleFiles\n";
InternalWay::run(); // prefer 2
ExternalWay::run();
InlineWay::run(); // prefer 1
}
};
static SharingGlobalConstantsAcrossMultipleFilesngAutoRunner autoRunInstance;