D
Daniel Nichols
I've noticed that in a C module (.c, .h file combination) that if you
create a function's definition before it is used in other functions
than a declaration is not necessary. I believe if the compiler can
find the definition of the function prior to encountering the use of
the function it will generate the prototype itself.
I don't currently use this feature, I explicitly create declarations
for all functions in a header file. However, I do think this feature
would be jolly useful for functions which can be thought of as private
to the module and nobody else ever needs to use. As well as not
actually appearing in the header file, so nobody will try to use it,
if the signature for this function is changed no changes are necessary
to the header file and we therefore remove a whole set of dependencies
when we re-compile.
Is the consensus that this is a good compiler side-effect to use or is
it best avoided, to become de-supported, already not supported by C++,
etc.
Thanks,
Daniel.
create a function's definition before it is used in other functions
than a declaration is not necessary. I believe if the compiler can
find the definition of the function prior to encountering the use of
the function it will generate the prototype itself.
I don't currently use this feature, I explicitly create declarations
for all functions in a header file. However, I do think this feature
would be jolly useful for functions which can be thought of as private
to the module and nobody else ever needs to use. As well as not
actually appearing in the header file, so nobody will try to use it,
if the signature for this function is changed no changes are necessary
to the header file and we therefore remove a whole set of dependencies
when we re-compile.
Is the consensus that this is a good compiler side-effect to use or is
it best avoided, to become de-supported, already not supported by C++,
etc.
Thanks,
Daniel.