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

Defining #if preprocessor condition in C

$
0
0

I wanted to define a compile time input validity checker for the library I am developing. So I thought maybe #define a function like #if preprocessor in C which is going to be compiled with GCC, something link this:

#define VALIDITY_CHECK(x) {#if (x)>10
                              #error "input out of range"
                              #endif}

But it doesn't work. So what is the proper way of writing such compile time validity checker?


Viewing all articles
Browse latest Browse all 22130

Trending Articles



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