-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Default Severity:Blocker
-
Impact:High
-
Likelihood:High
-
Default Quality Profiles:Sonar way
-
Legacy Key:GlobalMainFunction
-
Covered Languages:C++
-
Remediation Function:Constant/Issue
-
Constant Cost:20min
-
MISRA C++ 2008:7-3-2
-
PC-Lint:9142
A global function named main is the entry point to the program, and is the only identifier which must be in the global namespace. The use of main for other functions may not meet developer expectations.
Noncompliant Code Example
int main() { // Compliant } namespace { int main() { // Noncompliant } } namespace NS { int main() { // Noncompliant } }
See
- MISRA C++:2008, 7-3-2 - The identifier main shall not be used for a function other than global function main.
- is implemented by
-
CPP-176 Rule MISRA 7-3-2 : The identifier main shall not be used for a function other than the global function main
-
- Closed
-
-
CPP-707 Create Objective-C rules repository containing targeted rules
-
- Closed
-
- is related to
-
RSPEC-3051 "main" should have the right signature
- Active
1.
|
C-Family | RSPEC-4380 |
|
Active | Unassigned |