lundi 5 janvier 2015

(almost) Pure C instead of C preprocessor


Why isn't (almost) pure C used instead of the C preprocessor?


Sure I understand it would be a little more verbose. For example:



#define PI 3.14159


would be written like something like this:



#define PI {printf("3.14159");}


Yes, it's more verbose, but for more complex stuff I think it would help alot. Also, going with this design, programmers wouldn't have to learn another language (namely the C preprocessor) in order to write macros.


So, are there any other reason except the verbosity that the C preprocessor is not just pure C (with perhaps small modifications, like the addition of the define keyword)?





Aucun commentaire:

Enregistrer un commentaire