Utility to verify that all declared functions are defined

P

Paavo Helde

C++ lets you declare functions in headers which are actually not
defined in the source code. During a cleanup cycle for a library I
would like to ensure that all free and member functions advertised in
the library header files are actually defined inside the library. I
could imagine a utility which processes the header files and spits out
a piece of code which takes the address of each declared function.
Missing definitions would then show up as linkage errors.

Anybody know if such or a similar utility exists?

TIA
Paavo
 
P

Pete Becker

Paavo said:
C++ lets you declare functions in headers which are actually not
defined in the source code. During a cleanup cycle for a library I
would like to ensure that all free and member functions advertised in
the library header files are actually defined inside the library. I
could imagine a utility which processes the header files and spits out
a piece of code which takes the address of each declared function.
Missing definitions would then show up as linkage errors.

Anybody know if such or a similar utility exists?

If your test suite calls a function that hasn't been implemented you'll
get an error.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
 
P

paavo

If your test suite calls a function that hasn't been implemented you'll
get an error.

That's a good advice and in longer term perspective I am certainly
trying to follow that. However, currently there is no such
comprehensive test suite and too little time left (as always). I have
been cleaning up the code, put the functions in the right namespaces
and regularized the function signatures. This means that the function
might be there and working well as before, but because of slight
changes in namespaces and argument types it is not "connected" to the
header declaration any more. I was hoping there is a handy utility
which just lists me the functions which I have failed to synchronize
properly.

Best regards
Paavo
 
P

Pete Becker

That's a good advice and in longer term perspective I am certainly
trying to follow that. However, currently there is no such
comprehensive test suite and too little time left (as always).

Then your project is in deep trouble. Put another way: if you don't have
time to do it right, when will you have time to fix it?

I know that's unsympathetic, but there are far too many managers who
view testing as a nuisance, and don't allow adequate time for it in
their schedules. The result is, of course, lousy software.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top