Informix Error -4050: Function "name" has been used and hence declared as informal before this formal declaration.
Cause and resolution
Function "name" has been used and hence declared as informal before this formal declaration.
A call to this function appears prior to this declaration of it. Calls to undeclared functions are supported only for compatibility with previous versions of the 4GL language. When the compiler encountered the call to the function, it assumed an informal declaration for it. Move the declaration of the function to the top of the source module so that it precedes calls to it.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4050 fires when a function is called before its formal declaration appears — per the official guidance, calls to undeclared functions are supported only for compatibility with previous 4GL versions, and the compiler assumed an informal declaration when it first encountered the call.
- A function call appearing before that function's formal declaration in the source module, per the official guidance — the direct, only cause.
Solutions / Resolution
- Move the function's declaration to the top of the source module, per the official guidance, so it precedes all calls to it.
Examples
A call before the formal declaration
CALL save(1001)
...
FUNCTION save(id INTEGER)
-- -4050: save() was already called informally above
END FUNCTION
Corrected
FUNCTION save(id INTEGER)
...
END FUNCTION
CALL save(1001)
Diagnostic Checks
- Check whether any function is called before its formal declaration appears, and reorder the source so declarations precede their calls.
Related Errors / Related Topics
- -4046 — "Formal declaration appeared previously for this informal function definition. The formal declaration is invalidated." A related formal/informal declaration-ordering error, about a formal declaration being invalidated by a later informal definition, rather than a call preceding a formal declaration.
A function was called before its formal declaration — move the declaration ahead of all calls to it.