Re: typedefing a struct



"Charlie Gordon" <news@xxxxxxxxxxx> writes:
[...]
I guess the real question is what convention to follow for naming
structures and other types. The _t suffix is in wide use and
recognized by editors, but it violates POSIX constraints. Using an
initial capital is also in wide use in OOP but give C code a bad smell
of java. Using all caps would be consistent with FILE and Microsoft C
based APIs but looks ugly. I cannot settle for one over the others...

A digression:

I suspect the reason FILE is in all-caps is that it was invented
before typedefs were introduced to the language, and thus must have
originally been a macro. When typedefs were invented, it was too late
to change it.

The definition might have been something like:

struct file { /* ... */ };
#define FILE struct file

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.