Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A8-5-2 + A8-5-3: No usage of auto allowed?
#1
It appears that it's impossible to use `auto` variables and be compliant with both A8-5-2 (which mandates {} initialization for all variables) and A8-5-3 (which forbids {} initialization for auto variables)
Is that the intention? How is one supposed to use lambdas in that case?
Reply
#2
(11-08-2023, 05:36 PM)chgros Wrote: It appears that it's impossible to use `auto` variables and be compliant with both A8-5-2 (which mandates {} initialization for all variables) and A8-5-3 (which forbids {} initialization for auto variables)
Is that the intention? How is one supposed to use lambdas in that case?

Correct. You will need to follow a deviation process to allow that use case.
Reply
#3
You are correct that currently there is a contradiction between A8-5-2 and A8-5-3. This is highlighted in the examples for A8-5-3, which explicitly show non-compliances with A8-5-2. This can be used as part of the argument to deviate A8-5-2.

C++17 fixed the issue that A8-5-3 aims to prevent. If you are using a C++17 or later compiler, this can be used as part of the argument to deviate A8-5-3.

Autosar:2018 and MISRA C++:08 are about to be replaced by MISRA C++:23 which has been updated to remove these issues.
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)