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

GNU g++ preprocessor/compiler: printf value

$
0
0

Hi im looking for a solution for GCC to printf a value which is calculated during compilation.

There is message pragmas but they can only print a user input string. what im looking for is a printf style output where i can input parameters.

example

printf("hi %s, my value is %d\n", "john", 15);

example 2: searching solution for this

void dummy(MyObjectReference & obj)
{
#if(sizeof(obj) != 512)
#pragma message "cannot build, your object size is not 512, it is %d", sizeof(obj)
#error "stop build"
#endif

  obj.do_stuff();

  return obj.get_result();
}

Viewing all articles
Browse latest Browse all 22002

Trending Articles



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