In a well-designed project, I found the following declaration of a function (called cptwvv) in a header file:
int cptwvv(int, double, fftw_complex*, int, fftw_complex*, int, fftw_complex*, int);
Note that only the type of the arguments/parameters of the function cptwvv is claimed, but the variable name of each argument/parameter doesn't show up.
1. Is this form of function declaration legal/valid? For example, shouldn't "double" be "double xx"?
2. If this form of declaration is legal/valid, what is the difference between declaring something like "double" and doing that with "double xx"?
Thank you in advance for any comments and explanation.
1. It's legal.
2. In a prototype, nothing. The only time the name is used is when you are defining the function so you can access the parameter. Otherwise it is just for show, generally to help the caller see what each parameter is for by giving it a name.
Thanks for your post. For my second question, what do you mean by "nothing"? Do you mean that the regular declaration and the declaration in this way are same if they are used as prototypes? If this is the case (by this I mean that they are basically same), can I make all my declarations in a header file or forward declarations in this way without naming even a single variable but only its type?