Details
-
Type:
False-Positive
-
Status: Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: Subject: Uncategorized rules, Importance: Relevant, Level: Medium
-
Labels:None
Description
The rule raises false positives for the following functions
// FP if NDEBUG is defined int inverseFineStructurConstant() { #ifndef NDEBUG printf("accessing the fine structure constant\n"); #endif // NDEBUG return 137; } // FP if NDEBUG is not defined int mode(int client) { #ifndef NDEBUG return DEBUG_MODE; #else // NDEBUG return get_release_mode(client); #endif // NDEBUG }
The function definitions above cannot be changed without a significant rewriting of all their uses.
At the same time, the following is a true positive, but arguably it occurs less frequently than the above code:
int mode() { #ifndef NDEBUG return DEBUG_MODE; #else // NDEBUG return RELEASE_MODE; #endif // NDEBUG
Attachments
Issue Links
- is deprecated by
-
CPP-3456 S3400: Methods should not return constants: Deprecate this rule for CFamily
-
- Closed
-
- links to