Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Definition of "used" for Rule 21.3
#1
The rule states, in part, "The identifiers calloc, malloc, realloc and free shall not be used" but does not define what constitutes a use. Is the following example (intended to be) a violation of Rule 21.3?

Code:
void *(*mymalloc)(size_t) = malloc;
<t></t>
#2
I think that "used" here is intended to be "shall not appear in an expression" which would mean that your example violates Rule 21.3.
<t></t>
#3
With reference to the Glossary definition of used, such an attempt to obfuscate the calling of a prohibited function is still a usage.

Therefore, in the example cited, the function malloc() is being used.
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)