tags:

views:

366

answers:

6

It seems to be an 'accepted concept' in the popular culture of programming languages that 'C is portable assembler'. I have first heard this at least 15 years ago. But when did it really become part of the popular culture?

Note: if you don't agree that 'C is portable assembler', please just skip this question. This question is about 'popular culture of programming'. I'll add a comment to this question which you can up-vote for those who disagree with that statement.

+8  A: 

That was why C was developed. From the very, very beginning, C was designed for portability.

S.Lott
Sure - but was it thought of as a 'very low level' language when it was designed?
Jacques Carette
What does "very low level" mean? Low level by modern standards? Or low level by the standards of the day? It's a relative term. And -- in most cases -- meaningless.
S.Lott
@Jacques Carette: At the time, it was very high-level, compared to assembly.
rampion
In it's day, it was higher-level than "B". http://en.wikipedia.org/wiki/B_(programming_language) and BCPL. http://en.wikipedia.org/wiki/BCPL
S.Lott
@rampion: Prolog and LISP long pre-date C. Those are 'very high-level'. Even the originators of C (see Jerry Coffin's answer) did not think that C was high-level.
Jacques Carette
LISP has functions called "CAR" and "CDR". Contents of the Address part of Register number and Contents of the Decrement part of Register number. How is that "high level" when it specifically identifies hardware registers?
S.Lott
+1  A: 

My guess would be the first time that there was a higher level language than C.

That would make C portable, but still fairly low level (and at least in some minds, the closest you can get to Assembler and still be portable).

Justin Niessner
Which would make it 'never' since LISP pre-dates C by 2 decades.
Jacques Carette
@Jacqeues - Actually, that would make it "since it was introduced".
Justin Niessner
@Jacques. In a sense Lisp is quite low level. See the etymology of the terms `car` and `cdr` to see why. http://en.wikipedia.org/wiki/CAR_and_CDR
JeremyP
+4  A: 

The concept of C being "portable assembler" stems for the simple fact that most "pop-culture level" C programmers are too lazy to learn the language "hard" - academic - way, and instead prefer to "learn" from practice, in most part by associating the language commands with the implied underlying machine code. Most of these associations are based on rather ridiculous misconceptions about the language, which latter surface here (and on other forums) as questions along the lines of "I have 20 years of experience in C programming but I don't understand why my type-punning hack no longer works". Nevertheless, most of those "portable assembler" types actually take pride in their approach, considering everybody else not sufficiently competent to see assembly behind the C code :)

In other words, the only people who see C as portable assembler are the people who never bothered to learn the language. It is indeed just a pop-culture. C is not a portable assembler, and it is not really a matter of "agreeing" or "disagreeing" with it, but rather a matter of knowing it as a hard fact. The "popular culture of programming" you seem to be mentioning has very little connection with the professional C programming world.

AndreyT
So why do professional compiler writers frequently target C rather than assembler? As far as they are concerned, C is 'close enough' to the metal (and gcc is decent enough) so that it's not worth bothering going further down. [And I used to be a professional C programmer, I just grew tired of having to type so much to say so little. Of course, Java was worse in that way. But I'm one of those weird Haskell/O'Caml programmers].
Jacques Carette
And see Jerry Coffin's answer.
Jacques Carette
"In other words, the only people who see C as portable assembler are the people who never bothered to learn the language." Weird. In my experience it's "the only people who *don't* see C as a portable assembler are the people who never bothered to learn **another** language well." Amazing how perceptions can vary from person to person, no?
JUST MY correct OPINION
+21  A: 

From the Introduction to the first edition of The C Programming Language:

C is a relatively "low level" language. This characterization is not pejorative; it simply means that C deals with the same sort of objects that most computers do, namely characters, numbers, and addresses.

[ ... ]

Again, because the language reflects the capabilities of current computers, C programs tend to be efficient enough that there is no compulsion to write assembly language instead.

[ ... ]

Although C matches the capabilities of many computers, it is independent of any particular machine architecture, and so with a little care it is easy to write "portable" programs ...

At least the general idea of combining portability with the general capabilities of assembly language seems to have been there almost from the beginning.

Jerry Coffin
Best answer yet! I'll probably end up accepting this one.
Jacques Carette
Considering that it went hand-in-hand with the creation of Unix, it would be surprising if this weren't the case.
Mark Ransom
@Mark: OTOH, consider that Modula (the less known predecessor to Modula II) was developed in conjunction with the creation of the Lilith system, but is generally rather higher level.
Jerry Coffin
@Jerry, that might actually strengthen the case. Is the success of C vs. Modula an accident of history, or did the language designs give Unix an advantage from the start?
Mark Ransom
@Mark: I suspect it's at least partly that nobody really cared about Modula being a long-term success. Niklaus Wirth seems to want to ground his languages in reality, but he's always seemed more interested in exploring new things (mostly languages) than in managing and growing existing projects. It was also designed as an integrated system, so it didn't really accommodate other languages, etc., where Unix has always supported multiple languages, development styles, etc.
Jerry Coffin
JUST MY correct OPINION
A: 

At the exact moment the Smug Lisp Weenies forgot that their REPL was implemented in C.

John
That's interesting. I don't think I've seen a Lisp REPL written in C. Most of the Lisp REPLs I've seen were written in ... Lisp, shockingly enough. And since Lisp predates C by about 20 years or so, it's amazing that C was used to write those REPLs. That may be a selling point for Lisp Weenies to use: So far ahead of the times that we were using C **before it was first written!** (Translation: you may want to learn before speaking.)
JUST MY correct OPINION
Is there a "doesn't get the joke" badge on here?
John
+1  A: 

The moment they started extrapolating/ misinterpreting definitions of words :)

Assembly language: symbolic representation (a.k.a. mnemonics) of the numeric machine codes and other constants needed to program a particular CPU architecture.

Assembler: A program to convert assembly language into machine language.

C: A programming language which

    (1) is not a mnemonic of a particular CPU architecture
    (2) cannot be fed into an assembler

P.S:Feel free to downvote this answer as much as you want :)

itisravi
While I agree 100% with you, the question was: "When did people first start thinking ‘C is portable assembler’ ?" the "*portable assembler*" phrase itself was an analogy IMHO. A comparison. Not that C *is* an assembly language (and I don't think that the author meant that) but is considered *like* an assembly language. My 2cts. And no, I won't downvote a correct answer :)
sandra
I understood what the OP was trying to convey..i was just having some fun,especially since he put the phrase in quotes :P
itisravi