Mail Archives: djgpp/1997/12/16/16:15:36
In article <3495ac96 DOT 1274644 AT news DOT xs4all DOT nl>,
Hans 'the Beez' Bezemer <hansoft AT visitweb DOT com> wrote:
>ulric AT evelin DOT edu DOT stockholm DOT se (Ulric Eriksson) wrote:
>
>>The problem is that your solution (make the newbie learn Hans' Version
>>Of C Which Looks Like Pascal) is worse than the problem (make the newbie
>>learn C).
>Well, that is a point for debate. I'm sure I've prevented many errors by using
>these constructions (together with a standard and a list of pitfalls). First
>make it work (let 'em write acceptable programs) then improve it (teach 'em
>just another way to write the same thing).
Defining begin to stand for { and end to stand for } buys you absolutely nothing.
All you are doing is polluting the macro namespace. If some header file uses 'begin'
or 'end' for any purpose, it will break. Macros should not be used frivolously.
If you must define macros in some module's header file, they should be prefixed
in such a way that they are identified with the module. An identifier such as 'end'
is a poor naming choice for a globally used macro.
#include "pascal.h"
static char *fill(char *beg, char *end); /* oops */
As far as teaching newbies go, teaching them preprocessor abuses is not a good
way to start into the language.
- Raw text -