4 ms·
The second edition of K&R distinguishes between them by calling the pre-ANSI declarations old-style functions, and the ANSI declarations new-style functions. Al
by trealira 3y ago
The second edition of K&R distinguishes between them by calling the pre-ANSI declarations old-style functions, and the ANSI declarations new-style functions. Although, since it's not 1989 anymore, they're not exactly new to C either. ANSI C has been around for 35 years at this point, whereas in 1989, C was only 17 years old.
- fuzztester 3y agoYes, I knew that, though I did not mention it. In my previous comment, I was going to say (from memory), that in the second edition, i.e. in ANSI C, both types of declarations are allowed, old style and new style. Also, if you just wrote the declaration (return value, then function name followed by types with arguments in parentheses), followed by a semicolon, without a function body in braces, it was called a function prototype. MS C (as in, some version of Visual Studio's command line C compiler), had a flag to generate the prototypes from the function definitions. I had used it some. /Zg, possibly.
- trealira 3y agoSorry, I wasn't trying to imply that you didn't know that. I meant to suggest that it would be the most unambiguous way to differentiate them, but then realized that the names weren't accurate because C89 declarations aren't new anymore. So, I shouldn't have written the comment anyway.
- fuzztester 3y agoNot a problem anyway, but thanks for replying :) I see what you mean.