about rule20_5

6.20 Standard Libraries

Moderators: misra-c, david ward

Post Reply
Manisha Nikambe
Posts: 1
Joined: Thu May 27, 2010 5:50 am
Company: TCS

about rule20_5

Post by Manisha Nikambe » Tue Jun 15, 2010 7:38 am

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

MMouse
Posts: 18
Joined: Thu Jul 05, 2007 12:20 am
Company: Disney
Location: Florida
Contact:

Re: about rule20_5

Post by MMouse » Fri Jun 18, 2010 10:31 am

[quote="Manisha Nikambe"]void func()
{
int errno;//does even declaration of errno violates rule20_5,errno is user defined?
}[/quote]

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 ]

misra-c
Posts: 566
Joined: Thu Jan 05, 2006 1:11 pm

Re: about rule20_5

Post by misra-c » Tue Jul 13, 2010 9:53 am

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).
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “6.20 Standard Libraries”