From my previous knowledge in learning C, I know that preprocessor directive like #include , #define is ain’t a statement that’s why as the name implies , it is process before the program is compiled , therefore there’s no need for us to append a ; at the end of it.
In C++, it introduces me a new directive that is using , but why this directive append a semicolon? I thought it’s just like the previous directive I learn where it’s not a statement?
usingis not a preprocessor directive. It is seen and analyzed by the compiler proper.The fact that you often don’t put a
;at the end of#definemacros is because they are processed as “simple” text replacement by the preprocessor, e.g:would be a compiler error since the compiler would see: