LWN.net Logo

Dennis Ritchie RIP

Dennis Ritchie RIP

Posted Oct 14, 2011 21:07 UTC (Fri) by dashesy (subscriber, #74652)
In reply to: Dennis Ritchie RIP by Julie
Parent article: Dennis Ritchie RIP

I leaned C first, and a friend thought me pascal later when I had to use Delphi. The lengthy begin/end and semicolon separator concept was never appealing, C syntax is so natural and addictive.
I believe C is a better learning language because it is honest, and once you learn C the rest become more enjoyable too.


(Log in to post comments)

Dennis Ritchie RIP

Posted Oct 15, 2011 0:51 UTC (Sat) by HelloWorld (guest, #56129) [Link]

C syntax is so natural and addictive.
Yeah right. Stuff like void (*signal(int, void (*)(int)))(int); is totally natural. And this is not some random contrived example, but a declaration from the standard library.

Dennis Ritchie RIP

Posted Oct 15, 2011 11:12 UTC (Sat) by mpr22 (subscriber, #60784) [Link]

The syntax for declaring objects of pointer-to-function type being a bit hairy does not invalidate the general sentiment, and that particular case (declaring a function with a function-pointer argument and a function-pointer return type) is only a problem because the standards committee declined to set up the obvious typedef.

Dennis Ritchie RIP

Posted Oct 15, 2011 16:50 UTC (Sat) by HelloWorld (guest, #56129) [Link]

The syntax for declaring objects of pointer-to-function type being a bit hairy does not invalidate the general sentiment,
It's not only that, the syntax for declaring pointers to arrays suffers the same problem. And what bugs me most about it is that it would have been trivial to fix this: make * a postfix operator and use "i int;" instead of "int i;" for simple declarations. signal then becomes
signal(*(int) void) *(int) void;
Unfortunately, it's not going to happen :(

Dennis Ritchie RIP

Posted Oct 17, 2011 0:56 UTC (Mon) by ncm (subscriber, #165) [Link]

That's just its FORTRAN heritage.

When familiar element of a new language has stupid syntax, it's unforgivable -- yet they all do, even Go. Old languages get a free pass, because who knew, then? C has bad declaration syntax. LISP has ... well, everything. Yet they are above criticism. They have succeeded where so many others failed. To complain about them only reveals your insecurity.

C and C++ could still be fixed very simply by allowing a postfix dereference operator (in addition to the prefix one). "@" would serve.

Dennis Ritchie RIP

Posted Oct 17, 2011 11:45 UTC (Mon) by jwakely (subscriber, #60262) [Link]

auto signal(int, void(*)(int)) -> void(*)(int);

Dennis Ritchie RIP

Posted Oct 17, 2011 13:21 UTC (Mon) by HelloWorld (guest, #56129) [Link]

auto signal(int, void(*)(int)) -> void(*)(int);
Hey, let's be consequent ;)
 auto signal(int, auto (*)(int)->void) -> auto (*)(int) -> void;

Dennis Ritchie RIP

Posted Oct 19, 2011 8:02 UTC (Wed) by ncm (subscriber, #165) [Link]

That's just its FORTRAN heritage. When some element of a new language is stupid, it's unforgivable -- yet they all have them, even Go. Old languages get a free pass, because who knew, then?

C and C++ could still be fixed very simply by allowing a postfix dereference operator (in addition to the prefix one). @ would serve.

Dennis Ritchie RIP

Posted Oct 21, 2011 17:51 UTC (Fri) by giraffedata (subscriber, #1954) [Link]

C syntax is so natural

I think that's the first time I've heard that claim made; the typical view of C is the opposite: in exchange for density (function per source character) and power to control the object code, C was made awkward.

The first time I saw "typedef int foo" I thought it was backwards and had a hard time remembering it; I still do. It isn't natural. It also isn't natural for an imperative like "a=3" to have a value, which is why it's so easy to stare at 'if (a=3) {printf("a is 3")}' and not see the error.

I wonder what a person's background has to be to find C syntax natural.

I believe C is a better learning language because it is honest, ...

I think "honest" here must mean "low level," i.e. the source code correlates plainly with the object code. If you're trying to learn how to write programs that control the contents of memory, etc., I agree C is the better learning language. If you're trying to learn how to write programs to solve a computational problem, a high level language would be better.

When I learned programming, my teachers went out of their way not to mention CPUs, memory, cycles, addresses, etc. and have me concentrate on generic computation. C would have seriously foiled their efforts.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds