Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 6.9.2: Missing exception for user-defined literals?
MISRA C++ rule 6.9.2 (The names of the standard signed integer types and standard unsigned integer types should not be used) defines two exceptions (shortened):
1. for type aliases 
2. postfix operator, return type of main and argc of main.

Currently, there is no exception for user-defined literals.

However, the C++ standard defines as part of  [over.literal] §
3 The declaration of a literal operator shall have a parameter-declaration-clause equivalent to one of the
const char*
unsigned long long int
long double
const char*, std::size_t
const wchar_t*, std::size_t
const char16_t*, std::size_t
const char32_t*, std::size_t
If a parameter has a default argument (11.3.6), the program is ill-formed.

Is a exception for user-defined literals missing?
You are correct, 'user-defined literals' should also be an exception to this rule.

This will be added as a correction in the next version
Posted by and on behalf of
the MISRA C++ Working Group

Forum Jump:

Users browsing this thread: 1 Guest(s)