MISRA Discussion Forums
int main() and rule 6.3 - 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: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.6 Types (https://forum.misra.org.uk/forumdisplay.php?fid=33)
+---- Thread: int main() and rule 6.3 (/showthread.php?tid=539)



int main() and rule 6.3 - Lundin - 23-06-2008

I was wondering whether rule 6.3 applies to int main() or if this is should be a special exception? Ie should we write sint16_t main() or not?
Because if we state the width and signedness of main() we will suddenly make the app implementation-dependant and non-portable.

Also, ISO C strictly states that the return type shall be "int" on a hosted environment. One could interpret that as "it must be the primitive
data type int and no custom typedef".


Re: int main() and rule 6.3 - misra-c - 24-09-2008

In the definition of main, use the basic types int and char rather than fixed length typedefs.

This will be included in a future revision of MISRA C.