On 6/8/2011 10:03 PM, Josh Gargus wrote:
Looks like you beat me to the punch on my last email...
On Jun 8, 2011, at 9:39 PM, BGB wrote:
apparently, some people don't like using typedef for some reason I am
not entirely sure of...
According to wikipedia
(http://en.wikipedia.org/wiki/Struct_(C_programming_language)
<http://en.wikipedia.org/wiki/Struct_%28C_programming_language%29> ),
one of the main objections is namespace-pollution:
/* Example for namespace clash */
typedef struct account{ float balance; } account;
struct account account; /* possible */
account account; /* error */
... hence the idiom of appending _t to the typedeffed name, I guess.
I more often use FirstLetterCaps naming for types, so:
Account account;
in some cases, I also use a "_t" suffix, but personally this is rarer...
however, in some cases, I end up using "prefixCamelCase" for both public
types and public API functions, creating an added chance of clashes
(usually an API function and an API-related type).
another possibility is naming types with the convention:
"PrefixCamelCase" (vs "prefixCamelCase" for public API functions).
internal functions generally use "Prefix_CamelCase" or
"PREFIX_CamelCase", which can be generally taken as a "don't use without
good reason" formatting style. also goes for using "PREFIX_CamelCase"
for types.
however, it is a bit awkward sometimes as not all my code uses exactly
the same conventions (and, me digging around in some of my much older
code, found a good deal more stylistic variations, such as the now
mostly unusued "z = x + y;" formatting style, whereas I more generally
now use "z=x+y;" instead).
or such...
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc