Mail Archives: djgpp/2004/02/05/03:45:29
>> I assume that the compiler first translates the #define 's
>> into another source code file S and then processes
>> S in a second step.
>
>In effect, it does (in practice, the two phases run together).
>
>> So, can I code with macros and then make the compiler
>> output the preprocessed file S also, so that everyone
>> can have the source without macros, if he wants ?
>
>You can (see the -E sw to the compiler), but why would you like
>to?
didn't you critisize using macros just 2 mails ago, because readers
might not understand them ?
That's the way how they can get the source without macros.
>My recommendation is: when in Rome behave as a Roman.
that's not my motto !
I'd say: when you have to behave like a Roman there,then don't go to Rome.
I mean, a method isn't superior only why most people are using it.
When I use macros and also supply the translated,preprocessed -E source
then it can hardly be worse than coding without macros ?!
It's just an additional feature and readers can chose which version
they take.
>That is, when
>you work in a certain programming language, use the syntactic
>conventions of that programming language, even if facilities like
>macros allow you to redefine almost everything.
that reminds me to Don Knuth's programs.
http://www-cs-faculty.stanford.edu/~knuth/programs.html
He is one of the world's leading authorities for algorithms and he provides
many interesting programs on his webpage, but I can't read nor compile them
because he uses an own,unusual language similar to C but with some
special "macros".
I'd appreciate, if someone could tell me how to translate
his programs to C easily.
Guenter
- Raw text -