There is no benefit in user code, it’s just ugly. In the second example, the HuffCode_
isn’t even necessary since the struct
type is already named by the typedef
.
The only places where this can be useful are:
- When
StructName
is already in use,StructName_
gives a different name (but you should really come up with a better name). - Identifiers in the C standard library that are not defined by the standard shouldn’t conflict with user code identifiers. Therefore, C library writers use the
_
prefix in the hopes that users will not use that. Unfortunately, some users do. - In very old compilers, it may be useful to give the
struct
a different name than is used in thetypedef
. You need both thetypedef
and the other name if you’re building a linked structure (example).