Back to all reviewers

Use semantic identifiers

torvalds/linux
Based on 2 comments
C

Choose semantically appropriate identifiers and types that clearly represent their purpose. This includes using the correct data type (e.g., boolean for flags instead of integers) and ensuring proper spelling of all identifiers.

Naming Conventions C

Reviewer Prompt

Choose semantically appropriate identifiers and types that clearly represent their purpose. This includes using the correct data type (e.g., boolean for flags instead of integers) and ensuring proper spelling of all identifiers.

For boolean flags:

// Not recommended
int reboot_default = 0;  // Using integer for a boolean flag

// Recommended
bool reboot_default = false;  // Clear semantic meaning

For function and variable names:

  • Verify spelling correctness (e.g., “local_irq_save” not “ocal_irq_save”)
  • Choose names that accurately reflect the purpose or behavior

Using semantically appropriate identifiers improves code readability, reduces bugs, and makes maintenance easier by clearly expressing intent.

2
Comments Analyzed
C
Primary Language
Naming Conventions
Category

Source Discussions