Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 3-9-1
The rule states that the types for a function declaration and definition must be token-for-token identical. How literally should this rule be taken. I have two cases where this rule seems to conflict with normal or good practice.

1. In a function definition, a 'const' qualifier is often included for parameters passed by value as a promise that the implementation will not modify these parameters. This qualifier cannot be included in the declaration. For example:

T low_bits_mask(unsigned n);

T low_bits_mask(const unsigned n) {
return ~((~static_cast(0))

Messages In This Thread

Forum Jump:

Users browsing this thread: 1 Guest(s)