0

Here are the two lines relevant to the question:

float velNMOscale = (1.0f + (vel2nmo[0]))* (1.0f+  (   vel2nmo[0]))*vel2z[0];

assert( APPROX3( vel2xy[0], velNMOscale ) );

The warning message is:

ApplyStencilXYTTIOpt_x86.cpp:2049:15: warning: unused variable ‘velNMOscale’ [-Wunused-variable]
         float velNMOscale = (1.0f + (vel2nmo[0]))* (1.0f + (vel2nmo[0]))*vel2z[0];

The variable is actually used in the call to the function "assert()".

Why the warning?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • 1
    Are you compiling with `-DNDEBUG` in the command line options (or `#define NDEBUG` somewhere)? If so, the assert is a no-op and the variable isn't used. – Jonathan Leffler Feb 26 '16 at 03:16
  • @Jonathan. You are right. So the -DNDEBUG will ignore any "assert() " instruction? Thanks! – Herman Jaramillo Feb 26 '16 at 03:20
  • That is correct. The question was asked before but I could not find before asking it. Feel free to delete this post. Thanks. – Herman Jaramillo Feb 26 '16 at 03:24
  • Yes. The `` (or ``) header looks at the current value of the macro `NDEBUG` each time it is included. If the macro is defined, then the assert statement is compiled to a no-op (the equivalent of `((void)0)`). If the macro is not defined, then the assert is active and the variable will be tested. – Jonathan Leffler Feb 26 '16 at 03:24

0 Answers0