Moderators: misra-c, david ward
- Posts: 7
- Joined: Fri Oct 18, 2013 2:31 am
- Company: Renesas Solutions Corp.
Rule's title say "shall not be declared."
C90/C99 use the "declare" for function declarations and variable declarations.
And, macros are used the "define".
#define __BUILTIN_sqrt(x) (x) /* Non-compliant */
"example" is a rule violation for the macro definition.
To error the macro definitions could not be a role of rule 21.1?
- Posts: 564
- Joined: Thu Jan 05, 2006 1:11 pm
Rule 21.1 restricts the use of #define and #undef on certain names.
Rule 21.2 restricts the declarations of certain names.
As you found, we have incorrectly put an example in the incorrect rule.
Code: Select all
#define _BUILTIN_sqrt(x) (x) /* Non-compliant with Rule 21.1, but compliant with Rule 21.2 */
int _BUILTIN_sqrt; /* Non-compliant with Rule 21.2 */
Thank you for pointing this out to us.
Posted by and on behalf of
the MISRA C Working Group