[Sorry for the late reply; I have been out of the office.]
[re starting identifiers with an underscore]
It can be useful on struct members as a "suggestion" to users of an API
that the member is "private".
Surely a more effective suggestion is to have the API pass pointers
to an incomplete struct type, and not let the users see its contents
at all.
Not if you also want public members.
Obviously, but that's another advantage of my suggestion: it avoids
mixing public and private data in the same type, which is a Bad Idea.
If you really can justify a mix of public and private data in one type,
make it a struct of public members and a pointer to an incomplete
struct containing the private ones. There, that wasn't so hard, was
it?
Or even allow for macros to access bits of the struct
Premature optimization, generally. Unless an accessor call is in a
time-critical section of code, this trades robustness (from opacity
and abstraction) and ease of maintenance (because the calling code
needn't change) for a dubious - sometimes nonexistent, thanks to
caching effects - performance gain.
OO programmers are finally coming around to the understanding that
public members are bad for software maintenance. It'd be nice
(though unrealistic) to think that most experienced C programmers had
already figured that out.
--
Michael Wojcik (e-mail address removed)
Advertising Copy in a Second Language Dept.:
Tapestry of the encounting and the farewell, the birth and the death.
You can hear the human being's song running through the 100 years.
-- Squaresoft