Informix Error -4394: Warning: Formal parameters in informal function headers cannot have initial values. The initial value of this parameter is ignored. If this value is intended as the default parameter, then use formal function headers to specify defaults.
Cause and resolution
Warning: Formal parameters in informal function headers cannot have initial values. The initial value of this parameter is ignored. If this value is intended as the default parameter, then use formal function headers to specify defaults.
Although parameters in formal (function-prototype-style) definitions can have initial values, those in the informal function definitions cannot. The initial value of this parameter is ignored. If this value is intended as the default parameter, then use the formal definition format that uses function prototypes to specify defaults. Only NewEra returns this error.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4394 is a compiler warning: per the official guidance, parameters in formal (prototype-style) function definitions can have initial values, but those in informal function definitions can't — the initial value is simply ignored. Only NewEra returns this error.
- An informal function header giving a parameter an initial value, per the official guidance — the direct cause; the value is silently ignored, not an error that blocks compilation.
Solutions / Resolution
- If the initial value is intended as a default, use a formal function header (with prototypes) to specify defaults instead, per the official guidance.
Examples
An initial value on an informal parameter
FUNCTION save(id = 0)
-- -4394: informal headers ignore initial values; "= 0" has no effect
END FUNCTION
Corrected, using a formal header
FUNCTION save(id INTEGER DEFAULT 0) RETURNING INTEGER
...
END FUNCTION
Diagnostic Checks
- Check every informal function header for a parameter initial value, and switch to a formal header if a genuine default is needed.
Related Errors / Related Topics
- -4046 — "Formal declaration appeared previously for this informal function definition." A related formal/informal declaration-consistency error.
- -4047 — "Mixed informal and formal function declaration syntax. Return type is ignored." A related error about blending informal and formal syntax in one declaration.
An informal function parameter's initial value is silently ignored — use a formal header with
DEFAULT if a real default is needed.