0

Can anyone explain what is pure c code?

I was learning operating system and there came a thing where source code is converted to pure c code by preprocessor and I am not clear with the pure c code concept. Even a simple definition will be appreciated. Thank you.

30th Oct 2020, 2:19 PM
Avik Singla
2 Respostas
+ 4
I think "pure" is not a technical term here (maybe I am wrong). If you have #define X 5 int main () { return X; } then after the preprocessor runs we have C code that looks like int main () { return 5; } So the same code, but all the C preprocessor directives are gone. This can get pretty tricky with things like macros and #if, #ifdef, #pragma etc... I think this is what the author means by "pure". The C preprocessor is a dumb copy-paste machine and it takes C code with preprocessor directives and produces C code without.
30th Oct 2020, 2:34 PM
Schindlabua
Schindlabua - avatar