MISRA Discussion Forums
about rule20_5 - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA-C: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.20 Standard Libraries (https://forum.misra.org.uk/forumdisplay.php?fid=42)
+---- Thread: about rule20_5 (/showthread.php?tid=744)



about rule20_5 - Manisha Nikambe - 15-06-2010

void func()
{
int errno;//does even declaration of errno violates rule20_5,errno is user defined?
}


Re: about rule20_5 - MMouse - 18-06-2010

Manisha Nikambe Wrote:void func()
{
int errno;//does even declaration of errno violates rule20_5,errno is user defined?
}

YES. It is that simple. You can not use "errno"

In any event rule 20.5 does not apply here. You are not useing errno. You are using your own version. The rule that does apply here is 20.1 "Reserved identifiers, macros and functions inthe standard library shall not be defined, redefined or undefined."

[ removed by moderator ]


Re: about rule20_5 - misra-c - 13-07-2010

The previous poster is not quite correct. Defining your own version of errno does not violate Rule 20.5. However, reusing any identifiers reserved for use by the standard library does violate Rule 20.2 (note, not Rule 20.1 as stated by the previous poster which prohibits redefinition using macros).