3 ms·
The relevant MISRA rule (which is advisory, not mandatory) includes avoiding size_t, which is absolutely the correct type to use in a lot of pointer situations.
by AlotOfReading 3y ago
The relevant MISRA rule (which is advisory, not mandatory) includes avoiding size_t, which is absolutely the correct type to use in a lot of pointer situations.
- MaxBarraclough 3y agoDo you have a source for that? From a quick Google it doesn't seem to prohibit size_t. Rule 3-9-2 (which is only advisory) says Typedefs that indicate size and signedness should be used in place of the basic numerical types, but this doesn't prohibit use of size_t. https://forum.misra.org.uk/thread-1130.html https://forum.misra.org.uk/thread-1130.html
- AlotOfReading 3y agoI didn't say it prohibited size_t, only that it suggests avoiding it like other variable-sized types. In practice, compliance checkers will turn advisory rules into warnings, which means every usage of a size_t can potentially become a warning message. It's a lot of unnecessary noise for writing correct code.
- IshKebab 3y agoRead his link.