C's syntax (was Re: Python Formatted C Converter (PfCC))

Gareth McCaughan Gareth.McCaughan at pobox.com
Wed Oct 25 17:40:47 EDT 2000


Grant Griffin wrote:

> Having written a lot of Pascal right before I learned C, I found C's
> syntax to be quite a relief.  Isn't nice to type "{" rather than
> "begin"?  (Or, better yet, to type nothing at all in Python?  <wink>)

Yes.

> And isn't it nice that the properties of a C "for" loop are very
> simply--and flexibly--defined?--no arbitrary restrictions here.

It's nice that they're simply and flexibly defined. I'd be
happier if they were more readable. Of course, doing that
would need *gasp* a few more alphabetic characters visible
on screen, and that would never do. :-)

>                                                                  And why
> did Pascal ever need that bogus ":=" thing in the first place?

Because people confuse := and ==.

> <<designed by a guy who didn't use it much>>  Oh, and the C preprocessor
> is a beautiful thing whose absence, in retrospect, makes Pascal seem
> absolutely incomplete.

Whatever it may be, it isn't beautiful. Consider the
proliferation of parentheses in most macros (or, if
you prefer, the proliferation of bugs with macros that
don't have proliferating parentheses). Or the similar
situation with |if|s that necessitates the "do { ... } while (0)"
hack. Consider the inability to define macros with variable
numbers of arguments. Consider ... oh, all sorts of things.

Take the time to find out about macros in Common Lisp or
Scheme, play with them a bit, and then see what you think
of the C preprocessor.

(If this is all an elaborate joke and you really think just the
same about the C preprocessor as I do, please accept my apologies
for failing to spot it.)

> I guess if I were to pick on C's syntax (without emasculating it), about
> the only thing I could suggest would be "and" and "or" in place of "&"
> and "|". (Oops! I meant "&&" and "||"!)  OK, and I wish TRUE and FALSE
> were permenently defined.  

What you probably *ought* to wish is that C had a real
boolean type. :-)

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
sig under construc



More information about the Python-list mailing list