-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·27 lines (25 loc) · 890 Bytes
/
Copy pathmain.cpp
File metadata and controls
executable file
·27 lines (25 loc) · 890 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
#include <iostream>
#define MY_NAME "Haithem"
#define HAITHEM
#include "things.h"
void foo(){
#define SOMETHING "something"
something();
}
int main(){
int x = 0;
x++;
std::cout <<x;
std::cout << SOMETHING ; // this works just fine, preprocessor doesn't understand nor care about cpp syntax
#if 0
int z = 10;
/* multi line comment gets commented out
* usually this is not possible cause commenting a nested comment is not allowed
* */
#endif
#ifdef HAITHEM //you might be wondering why this works since we defined HAITHEM to be nothing, how come
//the preprocessor didn't replace HAITHEM in ifdef with nothing? in most cases macro substitution does not occur when a macro identifier is used within another preprocessor command
//with the exception of #if and #elif they do perform macro substitution
std::cout << MY_NAME << "\n";
#endif
}