Live data from Hacker News

C, The Beautiful Language

tenaciousc.com

51–60 of 85 posts

Re: C, The Beautiful Language

#51
post #21
post #16

Earlier quoted context omitted.

I wonder which Ronaldo he meant. I can't quite get over the moody, cheating side of Cristiano Ronaldo to appreciate his abilities. Having a Cristiano Ronaldo as a developer would be a bloody nightmare. It'd be like having a co-worker who turned in some inspired code, but who lied, stole, picked fights and was generally a chore to be around. I hope he meant Brazil's Ronaldo circa 2002 :)

Of course I meant Brazil's Ronaldo...what kind of sports fan do you think I am? :)

Aha the author. I enjoyed your article, but I might be biased as I love football and I quite like C!

Re: C, The Beautiful Language

#52
post #49
post #22

All it means is that he understands C better than other languages. Even Java (yes, Java) has these rhythms that he speaks of. You look at code and you feel the logic, even the necessity of it. That's just the feeling of being in tune with code and with the person who created it, thanks to a shared understanding of the language. Master any language and you'll get the same feeling when you read well-written code. Actua…

+1 C is ugly. - Why do I need to typedef a struct to make it look like any other type? - Why do function pointers look so bad? - Error handling in C? Those goto exception; if(0){exception:} sure look fantastic. - int* var1, var2; var2 is an int, not an int* ... The language lets you stick the * right next to the type as though it modifies the type. Which it does in casts. (how do I escape asterisks on here?) - A syst…

Well, OK... C is ugly. That doesn't hinder that it is also beautiful.

I did C for ten years, on and off. I stopped. C is an old love where the break up wasn't bad, it was just me that changed.

I realised what I really liked -- to get shit done! That is, to take an idea or a specification and make it exist in the "real" world. That implies the importance of speed, so I can get to the next idea. C just isn't for maximising speed of development, unless for really low level stuff.

Sometimes, I mourn a bit for what could have been.

Re: C, The Beautiful Language

#53
post #22

All it means is that he understands C better than other languages. Even Java (yes, Java) has these rhythms that he speaks of. You look at code and you feel the logic, even the necessity of it. That's just the feeling of being in tune with code and with the person who created it, thanks to a shared understanding of the language. Master any language and you'll get the same feeling when you read well-written code. Actua…

C is the language some may love to hate, but an experienced developer will create clean, concise code. I remember reading through cifsd [1] by cinap_lenrek and thinking, ``my god, this is beautiful''. No boilerplate, just straightforward code. And yes, unobtrusive error handling.

Also, a blogpost post comes to my mind: ``A Timeless, Desert Island Language'': `And that's why I'd choose C as my desert island language. Because in less than 10 pages of C, I can bootstrap a basic Lisp interpreter (...)'.

--

[1] http://plan9.bell-labs.com/sources/contrib/cinap_lenrek/cifs...

[2] http://www.findinglisp.com/blog/2008/06/timeless-desert-isla...

Re: C, The Beautiful Language

#54
post #49
post #22

All it means is that he understands C better than other languages. Even Java (yes, Java) has these rhythms that he speaks of. You look at code and you feel the logic, even the necessity of it. That's just the feeling of being in tune with code and with the person who created it, thanks to a shared understanding of the language. Master any language and you'll get the same feeling when you read well-written code. Actua…

+1 C is ugly. - Why do I need to typedef a struct to make it look like any other type? - Why do function pointers look so bad? - Error handling in C? Those goto exception; if(0){exception:} sure look fantastic. - int* var1, var2; var2 is an int, not an int* ... The language lets you stick the * right next to the type as though it modifies the type. Which it does in casts. (how do I escape asterisks on here?) - A syst…

- You don't. C99 treats structs like classes.

- Typedef them.

- If done right, it can be quite unobtrusive.

- That's not how it should be written. This is a 100 times clearer:

int *var1, var2;

- Not really. And don't use int, int32_t is where it's at.

Re: C, The Beautiful Language

#55
post #6

> we watch Ronaldo doing things on the pitch Hmmm... Lionel Messi does crazy things you never thought were possible. He's Lisp. Gareth Bale has few fancy tricks, but does what he does very well, and often relies on pure speed - C. Joey Barton is good, but has a bad reputation and a sordid history - Fortran? Etc :-)

You know your soccer my friend ... but you left out Java. I'd say that's like Miroslav Klose ... big, strong, not particularly fast or lovely to watch but damned good at putting away goals when it matters. surprisingly so.

Many people want to leave out Java, that's probably why Klose is currently a substitute.

Re: C, The Beautiful Language

#56
post #49

Earlier quoted context omitted.

+1 C is ugly. - Why do I need to typedef a struct to make it look like any other type? - Why do function pointers look so bad? - Error handling in C? Those goto exception; if(0){exception:} sure look fantastic. - int* var1, var2; var2 is an int, not an int* ... The language lets you stick the * right next to the type as though it modifies the type. Which it does in casts. (how do I escape asterisks on here?) - A syst…

- You don't. C99 treats structs like classes. - Typedef them. - If done right, it can be quite unobtrusive. - That's not how it should be written. This is a 100 times clearer: int *var1, var2; - Not really. And don't use int, int32_t is where it's at.

    int *var1, var2;
is not clear at all. var1 has type "int pointer", and for each type T, its pointer type is represented as the type T*. It's just one of the many ways the C user interface is broken beyond reason.

The point is not that you can't do good things in C. The point is that it is very easy to do bad things in C. A good UI makes good things the natural way to do things, and actively discourages bad things. C's UI is the opposite.

Re: C, The Beautiful Language

#57
post #2

C is more a description of a Harvard machine than a von Neumann machine. In fact, a useful new language feature would be dynamic generation of machine code.

Lisp provides exactly that: functions are lists (primary data structure of the language) of expressions (in VM's instructions) and you have direct access to VM's memory cells (conses, [1]). You can generate and change functions at runtime. For example, inject tracing code. Actually, at least in some implementations, all functions are created dynamically, except for a few core functions (implemented with C, d'oh).

And how `new' it is? 1958. Oh dear.

Re: ``C is more Harvard than von Neumann architecture''. Hardly; C is architecture agnostic. You can compile it for a Harvard PIC as well as for von Neumann CPU.

It may seem functions are execute-only, but on common CPUs you can treat them as data as well: read and modify (modulo memory protection). And the other way around too -- you can load a bunch of bytes from a DLL, resolve symbols to obtain pointers and use the pointers to execute the loaded bytes as functions.

--

[1] http://en.wikipedia.org/wiki/Cons

Re: C, The Beautiful Language

#58
post #22

All it means is that he understands C better than other languages. Even Java (yes, Java) has these rhythms that he speaks of. You look at code and you feel the logic, even the necessity of it. That's just the feeling of being in tune with code and with the person who created it, thanks to a shared understanding of the language. Master any language and you'll get the same feeling when you read well-written code. Actua…

I can sympathize with the author about C, but with Java... Every time I need to figure out a Java program, I end up being in almost physical pain. Huge trees of empty nested directories and files with nothing but method definitions that do nothing but return a property... or, better yet, tons of empty functions called pure virtual.

It's hard to feel the logic and necessity of code when you can't stop being flabbergasted why the language has to be so verbose and complicated.

I admire Java as an environment, but am scared shitless of it as a language.

Re: C, The Beautiful Language

#59
post #56

Earlier quoted context omitted.

- You don't. C99 treats structs like classes. - Typedef them. - If done right, it can be quite unobtrusive. - That's not how it should be written. This is a 100 times clearer: int *var1, var2; - Not really. And don't use int, int32_t is where it's at.

int *var1, var2; is not clear at all. var1 has type "int pointer", and for each type T, its pointer type is represented as the type T*. It's just one of the many ways the C user interface is broken beyond reason. The point is not that you can't do good things in C. The point is that it is very easy to do bad things in C. A good UI makes good things the natural way to do things, and actively discourages bad things. C'…

It's just one of the many ways the C user interface is broken beyond reason.

I'd say this one is just a question of preference. I happen to like to be able to declare my variables together with my ponters.

A good UI makes good things the natural way to do things, and actively discourages bad things. C's UI is the opposite.

In my opinion, that's the beauty of C: unlike Java (and, to a little extent, C++) it doesn't dictate how you write your programs. You are free to shoot yourself in the foot, but you also get to decide exactly how you want your code to look and feel.

Re: C, The Beautiful Language

#60
post #42
post #22

All it means is that he understands C better than other languages. Even Java (yes, Java) has these rhythms that he speaks of. You look at code and you feel the logic, even the necessity of it. That's just the feeling of being in tune with code and with the person who created it, thanks to a shared understanding of the language. Master any language and you'll get the same feeling when you read well-written code. Actua…

Exactly, and C is the worst offender for boilerplate code. There isn't even a list abstraction! It's surprising that there's an array abstraction and that people aren't just forced to use pointer arithmetic.

This is not fair. C was (and still is) intended for situations where writing your own list abstractions is the right thing to do.

Unlike lists, the array abstraction doesn't cost anything, as it's just straightforward pointer arithmetic underneath. This is why it is in the language.

Post reply on HN