top | item 39862230

(no title)

aib | 1 year ago

"[C] is simple but expressive, practical but admitting of elegance (think of some of the pointer arithmetic in K&R); it is small, fast, and portable; it is the lingua franca of programming and the language of languages[...]"

How anyone can think pointer arithmetic is elegant is beyond me. Especially when the title mentions a language with algebraic data types and higher order functions. Or even just RAII.

I'm also not sure C is the lingua franca of programming anymore. From my personal experience (and language is strongly tied to geography and culture) people tend to talk about strings and booleans, JSON and other custom types, stacks and heaps. ints and longs have fixed sizes and representations in their minds. (In fact, many C concepts are used erroneously from a strictly-C-language point of view.)

This is not to insult C, however, which is elegant in its simplicity (and perhaps The Mother of Modern Programming Languages, if you fancy a majestic title), nor the project, which has a noble goal.

discuss

order

akiarie|1 year ago

I like that, "The Mother of Modern Programming Languages". Perhaps it is better to call C the Latin of programming.

> How anyone can think pointer arithmetic is elegant is beyond me. Especially when the title mentions a language with algebraic data types and higher order functions. Or even just RAII.

I have nothing against algebraic data types. They're great. With respect to elegance, I will refer to nothing more than this (from K&R):

  /* strcmp: return <0 if s<t, 0 if s==t, >0 if s>t */
  int strcmp(char *s, char *t)
  {
          for ( ; *s == *t; s++, t++)
                  if (*s == '\0')
                          return 0;
          return *s - *t;
  }
I challenge you to provide a more elegant function with the same specification.