07-10-2015, 08:45 AM
Question 1
Rule 18.4.1 states that dynamic memory allocation shall not be used. This rule also applies to 'normal' usage of the STL containers. STL types could potentially be used with a custom allocator that did not require dynamic memory allocation.
Question 2
MISRA C++ does not have any guidelines on the use of friends.
Question 3
MISRA C++ includes rules on cast expressions, for example 5.2.6.
Question 4
A struct is a class that is implicitly public rather than private. Rules such as 6.9.x therefore apply to all classes, irrespective of the class-key used in their declaration.
Question 5
A deviation would be required for such a construct.
Question 6
Bounded string functions are better than the unbounded versions, however, as per 18-0-5 it is recommended that a safe string handling library is used.
Rule 18.4.1 states that dynamic memory allocation shall not be used. This rule also applies to 'normal' usage of the STL containers. STL types could potentially be used with a custom allocator that did not require dynamic memory allocation.
Question 2
MISRA C++ does not have any guidelines on the use of friends.
Question 3
MISRA C++ includes rules on cast expressions, for example 5.2.6.
Question 4
A struct is a class that is implicitly public rather than private. Rules such as 6.9.x therefore apply to all classes, irrespective of the class-key used in their declaration.
Question 5
A deviation would be required for such a construct.
Question 6
Bounded string functions are better than the unbounded versions, however, as per 18-0-5 it is recommended that a safe string handling library is used.
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group