c - A variable declaration following an argument list -
this question has answer here:
- what weird function definition mean? 5 answers
reading glibc, saw piece of code in string/strerror.c
:
char * strerror (errnum) int errnum; { char *ret = __strerror_r (errnum, null, 0); int saved_errno; if (__glibc_likely (ret != null)) return ret; saved_errno = errno; if (buf == null) buf = malloc (1024); __set_errno (saved_errno); if (buf == null) return _("unknown error"); return __strerror_r (errnum, buf, 1024); }
note how there int errnum
following argument list. how valid syntax? , doing?
that's old-style way of doing things, k&r, pre-ansi.
once function prototypes introduced, way of doing things rendered obsolete.
not actually obsolete since it's still valid in c11 (as per 6.9.1 function definitions /13
), few people use more).
it's specifying type of parameter function block, similar to:
char *strerror (int errnum)
Comments
Post a Comment