0

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?

1
  • 2
    This 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 Arno
    Oct 4, 2016 at 6:00

1 Answer 1

0

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.

2
  • forth, thank you. Would it be correct to talk about "the function that starts at line 34"?
    – Othman
    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. Oct 4, 2016 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.