23 Jan 2001 Darkman   » (Apprentice)

Hmm, well, just read the artice on altering C syntax "a thread on the c programming language", by apgarcia. Maybe because I do something different from most (Scientific and numerical analysis rather than systems, windoing or end-user applications), there are a few points I'd like to make.

Arsising from the article, Difference between assignment and comparison: It is impossible to confuse Fortran's = for assignment, and .eq. for comparison testing. That's the big reason why I use the dot notation, even through F90 does allow == for comparison.

Additionally, there are a few related points, not broached in the article.

Missing features A programming language is designed to be run on an particular set of hardware. However, name a language that can acess vector registers well?

This requires the language to have proper semantics for vector operations, otherwise your compiler will have to use some guesswork, making it difficult to predict behaviour. This is not present in C. I think that this is a barrier to using hardware efficently (I cite the PS2 - apparently it's vector registers are vastly underused).

Additionally, if doing something that is inherently vector (or matrix) based, a propert vector syntax makes the whole code a lot more readable, even if running on scaler hardware.

Variable declarations Compare:

  • integer, static, dimension(20) :: variable
  • static int variable[20];

Which is easier to read? I suspect that many would say the latter, due to familarity. I would argure the former (Fortran style). The first thing on the line tells you what type it is, rather buried in the middle. It makes the fact that an array different to a scalar apparent, rather than a modification to the name.

What about:

  • real, pointer :: p
  • float * p;

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!