1

I know that in C/C++ you declare function arguments like this:

type functionName(type arg1,type arg2 )
{
    ...code...
}

However there are a few places, for example here http://www.enderunix.org/docs/eng/daemon.php Where I see that a function can also be declared like this

type functionName(arg1, arg2)
type arg1;
type arg2;
{
    ...code..
}

Is that a valid declaration? I've never seen anything like that in any C/C++ manual, can anyone tell me if this is correct, what are the pros and cons for this type of declaration if it is valid, and if possible point me to some manual or document that explains this. Thanks

Michael P
  • 2,017
  • 3
  • 25
  • 33
  • 1
    The declaration with parameter types coming after the signature was the way it was done before ANSI C. This has never been valid in C++, though. – Sergey Kalinichenko Sep 18 '15 at 19:29

2 Answers2

2

This is old style K&R C. Not sure it will work for C++.

i486
  • 6,491
  • 4
  • 24
  • 41
2

This is C (k&r)

Not valid c++

mksteve
  • 12,614
  • 3
  • 28
  • 50