MISRA Discussion Forums
Rule 6.9.2: Missing exception for user-defined literals? - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=188)
+---- Forum: 4.6 Basic concepts (https://forum.misra.org.uk/forumdisplay.php?fid=192)
+---- Thread: Rule 6.9.2: Missing exception for user-defined literals? (/showthread.php?tid=1673)



Rule 6.9.2: Missing exception for user-defined literals? - kth - 26-02-2024

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] §16.5.8.3:
Code:
3 The declaration of a literal operator shall have a parameter-declaration-clause equivalent to one of the
following:
const char*
unsigned long long int
long double
char
wchar_t
char16_t
char32_t
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?


RE: Rule 6.9.2: Missing exception for user-defined literals? - misra cpp - 08-03-2024

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