Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22461

Is there a way to define a function with an implementation with a different name?

$
0
0

I have a function in a header that needs to be implemented for the rest of the code to work. Normally I would implement this function in main.c after including the header and the linker would clean up the rest.

For example let's say this function is void foo(bool); in foo.h

If I have another function implemented as part of some other code that matches the task exactly let's say void bar(bool); implemented in some bar.h and bar.c

I would normally go about linking the two by means of including bar.h and doing

void foo(bool var) {    bar(var);}

If there's a lot of these, it's basically just a lot of one line functions for telling the function to call a different one.

Is there a different way to accomplish this?


Viewing all articles
Browse latest Browse all 22461

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>