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

Disable GCC "may be used uninitialized" on a particular variable

$
0
0

I'm getting this warning on a stack variable:

warning: object.member may be used uninitialized in this function

In this case I do not wish to force initialization to just to get rid of the warning as it consumes CPU cycles. The variable is a POD structure so a memset on it is not zero cost. I can verify that the variable is never used uninitialized, so I'd just like to suppress the warning for it.

In general I do want the warning, just not on this particular variable in this particular scenario. How can I suppress the warning?


Looks like the pragma diagnostics are the correct way to go but they require quite a recent version of GCC (4.6)

No acceptable solution prior that version is known.


Viewing all articles
Browse latest Browse all 22165

Trending Articles



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