GCC - shouldn't a warning be issued when assigning an int to a char?

前端 未结 6 2016
你的背包
你的背包 2020-12-19 05:47

I\'ve recently set up a MinGW + MSYS environment on my laptop to check how things are with Netbeans C/C++ support. Everything seems to work fine, however, during my testing

6条回答
  •  鱼传尺愫
    2020-12-19 06:01

    In C, assigning an int to a char is legal.

    As it's legal (but possibly dodgy) the different compiler vendors do different things when they encounter this code.

    I guess MS is just being extra pedantic while the GCC guys have decided that it's not even worth a warning.

提交回复
热议问题