Page 1 of 1

Definition of "used" for Rule 21.3

Posted: Tue Sep 03, 2013 5:08 pm
by rgamble
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: Select all

void *(*mymalloc)(size_t) = malloc;

Re: Definition of "used" for Rule 21.3

Posted: Wed Sep 04, 2013 8:39 am
by Steve Montgomery
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.

Re: Definition of "used" for Rule 21.3

Posted: Thu Sep 12, 2013 10:32 am
by misra-c
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.