Names should be semantically meaningful and properly prefixed to prevent namespace conflicts. In C, enum variants and global identifiers are added to the top-level namespace, so prefix them with their type name even if repetitive. Choose names that reflect domain concepts and purpose rather than technical implementation details. Prioritize clarity over...
Names should be semantically meaningful and properly prefixed to prevent namespace conflicts. In C, enum variants and global identifiers are added to the top-level namespace, so prefix them with their type name even if repetitive. Choose names that reflect domain concepts and purpose rather than technical implementation details. Prioritize clarity over brevity by spelling out words fully.
Examples:
TSQuantifierOneOrMore
instead of OneOrMore
shift
(domain-specific) instead of status
(generic)ts_malloc_default
instead of ts_malloc_dflt
SUBTREE_SIZE
(semantic) instead of SUBTREE_4_BYTES
(technical)This prevents naming conflicts, improves code readability, and makes the codebase more maintainable by clearly indicating the purpose and scope of each identifier.
Enter the URL of a public GitHub repository