C's syntax (was Re: Python Formatted C Converter (PfCC))
William Tanksley
wtanksle at dolphin.openprojects.net
Wed Oct 25 14:43:12 EDT 2000
On Tue, 24 Oct 2000 20:42:24 +0100, Grant Griffin wrote:
>Alex Martelli wrote:
>> But that doesn't mean I have to keep silent when somebody
>> baldly asserts that C's syntax is "pretty good". Yecch. It's
>> most definitely *NOT*!
>Just for curiosity, could you be a little more specific here? Sure, C
>has its several known pitfalls. But those aside, what's so bad about
>it's syntax overall?
The pitfalls, for one ;-). C also makes pointers look terrible.
I don't mind the syntax, myself; the hard part for me is how incredibly
poorly designed the standard library is. A good library is able to catch
mistakes; C's library usually 'detects' errors by corrupting memory and
dying later.
In fact, there's a type of testing in which all external interfaces are
given semi-random parameters (chosen based on boundary conditions). The
goal is to get 100% detection of the bad parameters (it's okay to crash
immediately). C's library, when thus tested, detected almost none of the
misuse. It's a design flaw, not something a compiler can easily fix.
>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>)
True. That's rather a minor quibble, though -- it's even better to type
just 'end', or nothing at all. It's BAD to get confused about whether a
given statement is part of an IF (the distinction between blocks and
statements following ifs), or to have a syntax in which it's easy to not
notice that there's a semicolon at the end of the for loop, making it
empty and making the block after it execute exactly once when the for loop
completes.
>And isn't it nice that the properties of a C "for" loop are very
>simply--and flexibly--defined?--no arbitrary restrictions here.
Agreed.
>And why did Pascal ever need that bogus ":=" thing in the first place?
Well...
><<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.
Ugh. I HATE the C preprocessor. Wouldn't it be beautiful to be able to
parse the language using the language's own capabilities? Or at least to
be able to have some limited parsing and computation at compile-time?
Once you play with Forth, you're pretty much ruined for any other
language... Even Lisp just doesn't cut it.
>Grant R. Griffin g2 at dspguru.com
--
-William "Billy" Tanksley
More information about the Python-list
mailing list