MISRA C:2012 has no explicit library-specific restriction on <stdarg.h>?

Moderators: misra-c, david ward

Post Reply
bycho
Posts: 3
Joined: Tue Oct 04, 2016 6:56 am
Company: Korea University

MISRA C:2012 has no explicit library-specific restriction on <stdarg.h>?

Post by bycho » Tue Oct 11, 2016 10:26 am

A presentation slide from Andrew Banks, Chairman of MISRA C Working Group, says
that MISRA C:2012 has no explicit library-specific restriction on 7 standard headers and among these <stdarg.h> is included.
(page 13, http://www.open-std.org/jtc1/sc22/wg14/ ... /n2035.pdf)
so I thought I would be able to check whether a program is a conforming freestanding program or not by applying MISRA C:2012 guidelines.

However, in MISRA C:2012 Rule 17.1 says the features of <stdarg.h> shall not be used.

I think some rules of MISRA C:2012 are too restrictive to use in various kinds of industries.
Moreover, it makes me unhappy that complying with MISRA C:2012 doesn't imply conforming freestanding implementation.

is the slide wrong? or is there any mistake in my mind?
I'm beginner in MISRA guidelines, so I might have lots of errors.
I will appreciate your advices and help.

Andrew Banks
Posts: 36
Joined: Fri Feb 15, 2008 10:45 am
Company: LDRA & Intuitive Consulting
Location: Farnborough, Hampshire
Contact:

Re: MISRA C:2012 has no explicit library-specific restriction on <stdarg.h>?

Post by Andrew Banks » Thu Oct 20, 2016 10:36 am

Good spot! I've been using those slides (in one form or another) for a couple of years now, and no-one has spotted that before! I will update the slide, ahead of my next Conference!


The features of stdarg.h are prohibited by Rule 17.1 (Required) due to the range of Unspecified and Undefined behaviours associated with those features... most notably because the parameter types cannot be statically analysed. Good unit design should be able to remove the need for variable parameter lists.

If a variable number of parameters is really required, then a deviation (either with or without a Permit - see MISRA Compliance 2016) may be used - in this case, the deviation should detail all the necessary checks to ensure consistency between source and sink.
-----
Andrew Banks
Chairman, MISRA C WG
Posting in a personal capacity

Post Reply

Return to “7.1 The implementation”