Dir 4.6 and usage of "fast" types in stdint.h - 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:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 7.4 Code design (https://forum.misra.org.uk/forumdisplay.php?fid=181) +---- Thread: Dir 4.6 and usage of "fast" types in stdint.h (/showthread.php?tid=1377) |
Dir 4.6 and usage of "fast" types in stdint.h - michael.metivier - 12-10-2017 Directive 4.6 indicates "typedefs that indicate sign and signedness should be used in place of the basic numerical types" and suggests that, for C99-compliant systems, the types of should be used. stdint.h also defines "fast" types which are at least of the indicated length, but may be larger if such a length could be handled more efficiently by the processor. Is it a violation of Directive 4.6 to utilize these types? They are not "basic numerical types", but also do not necessarily adhere to a fixed length as specified by their names. Re: Dir 4.6 and usage of "fast" types in stdint.h - misra-c - 08-12-2017 The use of types such as int_fast8_t and int_least8_t violates Directive 4.6. The amplification to directive 4.6 states: Quote: A type must not be defined with a specific length unless the implemented type is actually of that length.The use of types such as int_fast8_t and int_least8_t does not guarantee that the type is actually of 8-bits. |