Linked by MOS6510 on Thu 10th Jan 2013 23:25 UTC
General Development "For years I've tried my damnedest to get away from C. Too simple, too many details to manage, too old and crufty, too low level. I've had intense and torrid love affairs with Java, C++, and Erlang. I've built things I'm proud of with all of them, and yet each has broken my heart. They've made promises they couldn't keep, created cultures that focus on the wrong things, and made devastating tradeoffs that eventually make you suffer painfully. And I keep crawling back to C."
Thread beginning with comment 548417
To view parent comment, click here.
To read all comments associated with this story, please click here.
saso
Member since:
2007-04-18

Then why did they not use Algol 60 or PL/I, which were the system programming languages of the time?

Because, if you had even read the few Wikipedia pages on C, you'd know that C derives from Algol 60. The line is roughly this: Algol -> CPL -> BCPL -> B -> C. Each of those steps had its reasons and I'm not going to list them here. Your attempt to portrait the designers of C as conceited merely shows that you carry a personal grudge that *your* language of choice didn't become ubiquitous (I presume it's Pascal, since you mentioned it so fondly - I've met a few FreePascal enthusiasts and they are argue quite similarly to you).
As for PL/I - it was first published in 1964 when the predecessors of C were already fairly underway in their own life, and it was a proprietary product of IBM (whereas C was designed at Bell Labs). Your romantic view of the wide availability of quality computer languages in the 60s is totally missing the reality of development back then.

Separate compilation is a primitive form of modules, but it is not the same.

Either they are modules (albeit in primitive form), or they aren't. You've managed to contradict yourself in a single sentence - good job. It's also sweet that you try to declare your definition of a module as authoritative. Have you ever considered that perhaps not everybody agrees with your definition?

Sure we could also keep on using the original UNIX, why care about progress?

Wow, FreePascal on Windows user, I presume. The aura of your smugness makes my screen damp. Simply because something is old doesn't mean it's bad.
Why do you think that "more features" = "progress"? Natural languages, for instance, often times simplify their grammar through more use (e.g. the regularization of the past-tense form of verbs in English).

Forget about the NULL character, boom!

NULL is actually a macro typically defined to ((void*)0), but I understand if your case-insensitive eyes don't see the difference.
Offhand remarks get offhand responses.

Arrays should not be manipulated as pointers.

Yes, your personal opinion on the matter is really insightful.

As for the usual C argument about arrays bound checking, all modern languages that compile to native code allow for selective disable of bounds checking if required.

This would be easy enough to introduce into C as well, say, by introducing an "array" keyword in variable definitions (which would turn on dynamic range checks). No need to redesign the language from the ground up. Might be nice to have, no dispute there.

Almost every other static type language out there?

This is a pretty slimy tactic to try and shift the burden of proof onto me. I'd now have to provide an extensive list to show that other static type checking languages out there have more relaxed rules, never mind even how one would qualify what "weak" and "strong" static type checking means. I don't play this way. You claimed C type checking is weak, it's yours to prove, not mine to disprove.

Except, like register, the compiler is free to ignore it and besides gcc and clang many C vendors still don't fully implement C99.

Oh my, is support really that bad?! Oh wait, you just pulled that one straight out of your behind:
https://en.wikipedia.org/wiki/C99#Implementations
Mind you, GCC still isn't fully C99 compatible: http://gcc.gnu.org/gcc-4.7/c99status.html so even your "GCC and clang" statement is false. Do you even google before you assert something?

In our society people tend to get money for their work.

That's not what I meant. I mean is that some random dude on the Internet isn't going to persuade me to spend money on a product that he insinuates will "fix" my coding practices.

You can always turn off false positives.

Obviously you've never built any bigger product somebody else coded from source, have you? I don't have the time to comb through somebody else's build tools to find which options fail and how to disable them.

UNIX is just one OS among many

Other platforms have other static analyzers. But UNIX has been the platform of birth for C, so I just wanted to show you that what you say here is not news to native C coders.

Being available does not mean developers use it

So you think forcing people is the proper approach? Have you ever considered that some people might not like that? Of course not, you are beyond error (see "arrays shouldn't be treated as pointers" comment above).

Like in many other languages.

What I was talking about is the contrast between highly abstract languages (Objective-C's OO part, Java, etc.) and lower abstraction languages (C). Of course you can write data crunching in other low-level languages (even Assembly for that matter).

Sure, when compared with the original ISO Pascal. The ISO Extended Pascal as any other Pascal dialects are more expressive than C.

Except that ISO Extended Pascal didn't exist when Kernighan and Ritchie designed C, so your citation of Ritchie to support your case misses the chronological order in which these languages appeared. According to Wikipedia, the first Pascal compiler in the US was written for the PDP-11, much later than UNIX appeared and probably even after C.

UNIX is a good operating system, but it is not the god of operating systems.

I never said so, but it's history is intertwined with C, so knowing about UNIX gives you a good idea how C developed.

Reply Parent Score: 4

moondevil Member since:
2005-07-08

"Then why did they not use Algol 60 or PL/I, which were the system programming languages of the time?

Because, if you had even read the few Wikipedia pages on C, you'd know that C derives from Algol 60. The line is roughly this: Algol -> CPL -> BCPL -> B -> C. Each of those steps had its reasons and I'm not going to list them here. Your attempt to portrait the designers of C as conceited merely shows that you carry a personal grudge that *your* language of choice didn't become ubiquitous (I presume it's Pascal, since you mentioned it so fondly - I've met a few FreePascal enthusiasts and they are argue quite similarly to you).
"

Well yes.

I never used FreePascal though.

I am old enough to have used C and Pascal when the first compilers were being made available in ZX Spectrums.

As for PL/I - it was first published in 1964 when the predecessors of C were already fairly underway in their own life, and it was a proprietary product of IBM (whereas C was designed at Bell Labs). Your romantic view of the wide availability of quality computer languages in the 60s is totally missing the reality of development back then.


I didn't say they were top quality, only better than C.

According to epoch documentation many companies did license languages on those days.

"Separate compilation is a primitive form of modules, but it is not the same.

Either they are modules (albeit in primitive form), or they aren't. You've managed to contradict yourself in a single sentence - good job. It's also sweet that you try to declare your definition of a module as authoritative. Have you ever considered that perhaps not everybody agrees with your definition?
"

I only care about the Computer Science definition and C does not offer that.

http://en.wikipedia.org/wiki/Modular_programming

"Sure we could also keep on using the original UNIX, why care about progress?

Wow, FreePascal on Windows user, I presume.
"


Never used Free Pascal.

Windows is just another operating system among many.

The aura of your smugness makes my screen damp. Simply because something is old doesn't mean it's bad.
Why do you think that "more features" = "progress"?


Usually more features tend to improve programmer's productivity.

Natural languages, for instance, often times simplify their grammar through more use (e.g. the regularization of the past-tense form of verbs in English).


Well, actually English grammar was originally simplified thanks to the Normand occupation:

http://geoffboxell.tripod.com/words.htm

"Forget about the NULL character, boom!

NULL is actually a macro typically defined to ((void*)0), but I understand if your case-insensitive eyes don't see the difference.
Offhand remarks get offhand responses.
"

I have seen enough code like str[index] = NULL to make that statement.

Not everyone writes str[index] = '\0', specially the ones that like to turn off warnings.

Too many scars of off-shoring projects.

"Arrays should not be manipulated as pointers.

Yes, your personal opinion on the matter is really insightful.
"

I imagine any security expert would agree, but I might be wrong.

"Almost every other static type language out there?

This is a pretty slimy tactic to try and shift the burden of proof onto me. I'd now have to provide an extensive list to show that other static type checking languages out there have more relaxed rules, never mind even how one would qualify what "weak" and "strong" static type checking means. I don't play this way. You claimed C type checking is weak, it's yours to prove, not mine to disprove.
"

Should I now give a CS lecture about classes of static typing?

"Except, like register, the compiler is free to ignore it and besides gcc and clang many C vendors still don't fully implement C99.

Oh my, is support really that bad?! Oh wait, you just pulled that one straight out of your behind:
https://en.wikipedia.org/wiki/C99#Implementations
"

I am well aware of that Wikipedia page.

There many more C vendors than what Wikipedia lists and many customers don't let you choose the compiler to use.

Mind you, GCC still isn't fully C99 compatible: http://gcc.gnu.org/gcc-4.7/c99status.html so even your "GCC and clang" statement is false. Do you even google before you assert something?


That assertion was because many think that gcc and clang are the only compilers that matter.

"You can always turn off false positives.

Obviously you've never built any bigger product somebody else coded from source, have you?
"

Well, have you ever done a 300+ developers multi-site project?

"UNIX is just one OS among many

Other platforms have other static analyzers. But UNIX has been the platform of birth for C, so I just wanted to show you that what you say here is not news to native C coders.
"

To expert C coders, you mean.

"Being available does not mean developers use it

So you think forcing people is the proper approach? Have you ever considered that some people might not like that? Of course not, you are beyond error (see "arrays shouldn't be treated as pointers" comment above).
"

No, I am just a meaningless person in this world.

Just stating my opinion.

"Sure, when compared with the original ISO Pascal. The ISO Extended Pascal as any other Pascal dialects are more expressive than C.

Except that ISO Extended Pascal didn't exist when Kernighan and Ritchie designed C, so your citation of Ritchie to support your case misses the chronological order in which these languages appeared. According to Wikipedia, the first Pascal compiler in the US was written for the PDP-11, much later than UNIX appeared and probably even after C.
"

Point taken.

"UNIX is a good operating system, but it is not the god of operating systems.

I never said so, but it's history is intertwined with C, so knowing about UNIX gives you a good idea how C developed.
"

Agreed.

Reply Parent Score: 2

saso Member since:
2007-04-18

I didn't say they [Algol 60, PL/I] were top quality, only better than C.

And here we go with the blanket statements again, asserted without proof.

According to epoch documentation many companies did license languages on those days.

Yep, they did, but Bell Labs obviously didn't feel the needed to.

I only care about the Computer Science definition and C does not offer that.

http://en.wikipedia.org/wiki/Modular_programming

Oh really? Then I quote from the linked Wikipedia page you linked:
Modules are typically incorporated into the program through interfaces. A module interface expresses the elements that are provided and required by the module. The elements defined in the interface are detectable by other modules. The implementation contains the working code that corresponds to the elements declared in the interface.

Since 1989 C has had rigorous support for this kind of compartmentalization (.h interface files, .c implementation files) and virtually every single project I've ever laid eyes on has used it. Of course it's rudimentary, but there are higher constructs on top which provide most, if not all of the features you would expect.

Usually more features tend to improve programmer's productivity.

By that logic, more controls on a car means better/safer/more productive driving. In actuality, Einstein's famous (possibly apocryphal) quote captures reality much better: "Everything should be made as simple as possible, but not simpler."

Well, actually English grammar was originally simplified thanks to the Normand occupation:
http://geoffboxell.tripod.com/words.htm

I said 'often times', not 'always'. Obviously at times languages expand in complexity to incorporate new necessary concepts and there's nothing wrong with that.

I have seen enough code like str[index] = NULL to make that statement. Not everyone writes str[index] = '\0', specially the ones that like to turn off warnings.

These programmers deserve a kick in the nuts for the above construct. This will produce warnings (implicit cast of void * to char) and is indicative of the fact that the author doesn't actually understand how computers work. I personally prefer str[index] = 0; Same meaning, less text, clearer.

Too many scars of off-shoring projects.

Ah well, if you buy cheap product, don't be surprised when it turns out to be shoddy. I have the same experience with offshore. Having a "safer" language means they will just provide you with dumber code monkeys.

I imagine any security expert would agree, but I might be wrong.

Security is not a simple yes/no game - the most secure computer is one that is off. It's all about finding middle ground. Some code warrants your approach, some doesn't. Making blanket statements, however, will guarantee that at times you will throw the baby out with the bathwater.

Should I now give a CS lecture about classes of static typing?

If you can't support your claims, don't make them. But before you dig into it, take a look at: https://en.wikipedia.org/wiki/Strong_typing#Variation_across_program...
Note that some of these definitions are contradictory, others are merely orthogonal, and still others are special cases (with additional constraints) of other, more "liberal" (less strong) definitions. Because of the wide divergence among these definitions, it is possible to defend claims about most programming languages that they are either strongly or weakly typed.

So any statements you present will most likely just express your personal opinions on the matter. Oh and I have an MS in CS, so I've heard them before (including "C sux", "C rocks" and "Let's code everything in Prolog").

I am well aware of that Wikipedia page.
There many more C vendors than what Wikipedia lists and many customers don't let you choose the compiler to use.

If your hands our bound by your customer, then I suspect you have other problems in your project, not just with the language.

Well, have you ever done a 300+ developers multi-site project?

I was talking about things like X.org, KDE, the Linux kernel, Illumos, etc. These are humongous code bases with tons of external dependencies and when doing a project that uses them, I don't have the time to go through each and every piece and fix a maintainer's bad assumptions about build environments, often times just to test a solution. That's why I said -Werror is good for development, bad for distribution.

To expert C coders, you mean.

Agree, it's probably news to you. GCC, for instance, supports -W and -Wall, both of which together activate lots of helpful static code analysis in GCC (unused variables, weird casts, automatic sign extensions, etc.).

Just stating my opinion.

No problem there - when you clearly state something as personal opinion, I have no problem. It's only the assertions and blanket statements that make my blood boil. We could probably understand each other over a beer much better than over the Intertubes.

Reply Parent Score: 4

znby Member since:
2012-02-03

"Then why did they not use Algol 60 or PL/I, which were the system programming languages of the time?

...
As for PL/I - it was first published in 1964 when the predecessors of C were already fairly underway in their own life, and it was a proprietary product of IBM (whereas C was designed at Bell Labs). Your romantic view of the wide availability of quality computer languages in the 60s is totally missing the reality of development back then.
"

Interestingly enough, Multics, whose developers included Ritchie and Thompson, was written in PL/1 and used one of the first non-IBM compilers for the language. PL/1 was by all accounts a product of 'design by committee' and compilers for it which supported the entire language were difficult to implement and required high end computers at the time.

Reply Parent Score: 1