Is there a distinction between a function definition (not a declaration) and a function?
For me a function definition, is what gets defined by the programmer in the source code while the function it self is what we get after compilation.
Is that a valid distinction?
-
2This sounds very opinion-based to me. I don't think your definitions are necessarily wrong, I just don't see the point to having a distinction and would call both, a function.– David ArnoCommented Oct 4, 2016 at 6:00
1 Answer
Sure, there's a difference between a function and a function definition, otherwise we wouldn't bother having both terms. Function isn't just an abbreviation of function definition, they're separate terms that are used in different contexts.
For instance:
The function definition for
readInput()
starts on line 34.
But:
Input data are retrieved by the
readInput()
function.
It would be simply wrong to use function definition here. The function definition has a certain number of tokens, occurs at a specific place in the program and an be pointed out in a program listing. The function has a specific purpose, is active at specific times, and can be pointed out in a call stack or a memory segment.
-
forth, thank you. Would it be correct to talk about "the function that starts at line 34"?– OthmanCommented Oct 4, 2016 at 7:57
-
@Othman Yes, it's generally okay to use the shorter form of a longer term when the context makes clear the meaning. Only the opposite would be misleading. Commented Oct 4, 2016 at 8:15