Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule M7-3-4 and UDLs
#1
When using UDLs like the ones provided by std::chrono, for example, we get a violation of rule M7-3-4 when including the UDL namespace:

Code:
using namespace std::chrono_literals; // <- violation here

Naturally, this rule was written before UDLs were a thing and so it's inevitably not designed for this use case.

We have discussed two options for this:
  1. Partially deviate for this use case only
  2. Explicitly import the required UDL(s)
The first option is probably okay if we can limit the scope sufficiently but someone has to write it and defend it.
The second option requires writing code similar to:
Code:
using std::chrono_literals::operator""s;
using std::chrono_literals::operator""ms;
which is a little cumbersome, especially for developers unfamiliar with how a UDL is written.

What I would like to know is how MISRA intends to handle UDLs in the upcoming guidelines? If they are allowed, how should they be imported for convenient use? Will M7-3-4 be updated to include an exception for namespaces that define UDLs?

Thank you in advance for you time.

/Dave
Reply


Messages In This Thread
Rule M7-3-4 and UDLs - by davebrown - 18-03-2022, 01:27 PM
RE: Rule M7-3-4 and UDLs - by misra cpp - 22-03-2022, 11:02 AM
RE: Rule M7-3-4 and UDLs - by davebrown - 29-03-2022, 02:13 PM
RE: Rule M7-3-4 and UDLs - by misra cpp - 29-04-2022, 02:33 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)