On 9/9/05, _z33 <[EMAIL PROTECTED]> wrote:
> I had a wierd doubt today morning. If a function's return type is not
> defined, "C" takes it as returning "int". Now, what does it do when I
> don't specify the arguments of the function. Something like this -
>
> void sampleFunc ()
> {
> /* ... */
> }
>
> Is this equivalent to saying,
>
> void sampleFunc (void)
> {
> /* ... */
> }
Yes, technically both are equivalent. The latter is the new style
while the former is the "old" style. But be aware: A function defined
using the old style does __not__ establish a prototype, but if a
previously declared prototype for that function exists, the parameter
declarations in the definition must exactly match those in the
prototype after the default argument promotions are applied to the
parameters in the definition.
Conclusion: avoid mixing old style and prototype style
declarations/definition for a given function. It is allowed but not
recommended.
Regards
\Steve
--
Steve Graegert <[EMAIL PROTECTED]>
Software Consultancy {C/C++ && Java && .NET}
Mobile: +49 (176) 21248869
Office: +49 (9131) 7126409
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming"
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html