24 Jan 2001 GJF   » (Apprentice)

Re: C Programming language.

apgarcia recently revisited the idea of an improved C. I have become resigned to using C or C++ over the last few years - it has such momentum. My main criticism of C is readability -
for( int i=0;i<j; i++ ) printf("unreadable\n");
I much prefer the Pascal syntax, but I acknowledge the criticisms in Why Pascal is Not My Favorite Programming Language. Some years ago, I worked mainly in Modula II, which is still my favorite language syntax. The main drawbacks must be the lack of libraries (and maybe their design) and lack of objects. But it did have some features I think of as highly desirable:

  • Explicit termination (END) for all IF statements
  • No macros
  • VAR parameters rather than explicit pointers
  • The HIGH function for determining the dimension of an array passed as a parameter to a function
  • Good control of name spaces and interfaces by the use of declarations in .DEF files (rather than extern and/or #include)

The Modula II compiler I was using had some extensions to allow low level programming. I think language extensions should be discouraged,but they did allow me to write a simple VGA graphics library - and that taught me a lot. In particular I learnt that a good optimising compiler can produce faster code than the assembly code I found published in a book!

After abandoning Modula II for C, I went through a brief phase of working with Delphi, which I quite liked. Delphi encourages much more readable code than C++, but of course it is proprietary. The name space system is a bit more primative than Modula II as well.

The company I work with has been doing a lot of Java work, and I guess Java tidies up some of the worst excesses of C and C++, I think it is unfortunate they kept some of the ugly syntax features (for loop, {} braces etc). Maybe with minor modifications to the compiler, we could plug-in a new tokeniser and make the language truly readable?

Early Java virtual machines were pretty slow and unstable, but the new ones can be pretty good. I still prefer native compilers/languages.

So these days my preference is C++, but there seems to still be compatibility problems with libraries on Linux, so I guess I'm stuck with C.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!