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

Replace C function and mark the older as error/deprecated

$
0
0

The question is a bit tricky but it is quite simple.

Have a shared code in C, and I would like to "ban" some function (typically system()). There will be a replacement function (eg. my_system()). This replacement function will use the original function but with integrated checks.

I have made some research and find the keyword poison:

#pragma GCC poison system

And I can declare my custom function before the pragma:

int my_system (const char *line){
    ...
    system(line_ok);
    ...
}

Is it the right way to proceed?


Viewing all articles
Browse latest Browse all 21994

Trending Articles



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