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

Why -Wparentheses doesn't give warning for if (int x = someFunc())?

$
0
0

While compiling with -Wparentheses this will give a warning and it is understandable

if (myVar= myFunct(param1)) {
     // do some stuff
}

but when we declare variable inside if block, compiler doesn't give warning. Why?

if (int myVar= myFunct(param1)) {
     // do some stuff
}

g++(GCC) 4.8.5


Viewing all articles
Browse latest Browse all 22165

Trending Articles



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