Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 8.4 - main function
#3
Rule 8.4 is required, not mandatory. Directive 4.6 isn't relevant here, as it isn't concerned with prior declaration.

Although main has external linkage, I think that the MISRA WG would deem it to have 'no linkage'. The rule and its rationale don't really apply to main, as it isn't called by another translation unit.

Going by the exact wording of the rule, however, I'm not sure whether the following is necessary to avoid a formal deviation:

Code:
int main(void);

int main(void)
{
    ...
}

I think that this would be confusing to someone maintaining the code.

Also, when I wrote 'prototype' in the original post, I really meant declaration in prototype form.
<t></t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)