C function declared with empty parentheses instead of (void)

ID

objectivec.maintainability.function_no_param_void

Severity

info

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Declaration

Language

Objective-C

Description

Reports a C function declaration or definition whose parameter list is written as () rather than (void). Objective-C methods, calls to a function, and statements that merely begin with a keyword are not reported, and neither is a typedef of a function-pointer type.

Rationale

In C, () does not mean "no parameters" - it means the parameter list is unspecified, so the compiler stops checking the call site and any number of arguments of any type is accepted without a diagnostic. A call written against an older signature keeps compiling after the function has changed, and the mismatch surfaces as a corrupted argument at run time rather than as a build error.

The following code illustrates the pattern detected by this rule:

// FLAGGED: C function declared with empty parentheses instead of (void)
static void resetCounters();

Remediation

Write (void) in the parameter list of every C function that takes no arguments, in both the declaration and the definition, so the compiler checks each call.

Configuration

This detector does not need any configuration.

References

© 2026 Xygeni. All rights reserved