[previous] 1303 [next] An empty parameter list in a function type has a different meaning in C++.
C++ compatibility REFERENCE - ISO:C90-6.5.4.3 Function Declarators (Including Prototypes) - Semantics, ISO:C90-6.9.4 Future Language Directions

A function is being declared with an empty parameter list.

In C++, a declaration of this form means that the function has no parameters. In C, it means that the number of parameters is unspecified; there may be none or there may be several. If a function has no parameters it should be declared with a parameter list consisting simply of the keyword 'void'. If a function does have parameters it should be declared with a function prototype.

For example:


/*PRQA S 553,2017,3210,3447 ++*/


extern int f1();                        /* Message 1303 and 3001 */
extern int f2(void);

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents