Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"- That's not how it should be written. This is a 100 times clearer:

int var1, var2;"

Somewhat aside from the actual article, but this might actually be the least clear way to write a definition, since the pointer marker appears to belong to var1, but not the overall definition of int. Here is how I would automatically read the definitions:

"int var1, var2;"

Of type int (variable), create var1, var2.

"int var1, var2;"

Of type int and type * (pointer), create var1, var2.

"int var1, var2;"

Of type int, create pointer var1, pointer var2.

"int *var1, var2;"

Of type int, create pointer var1, default (variable) var2.

Not sure how this works for and against C, since the language definition is really old at this point and by the standards of its time C is really clear. But languages have moved on and a standard has emerged over the intervening time that is a bit more logical.

Also, I think this article is a real piece of fluff :).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: