MISRA Discussion Forums

Full Version: MISRA C:2012 has no explicit library-specific restriction on <stdarg.h>?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 is included.
(page 13, http://www.open-std.org/jtc1/sc22/wg14/w.../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 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.
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.