代码:
char buffer[] = {0x01, 0x02, 0x03, 0x04};
使用g++编译
g++ -o outfile sourcefile.cpp
的时候,出现以下错误:
error: narrowing conversion of 'x' from ‘int’ to ‘signed char’ inside { } [-Wnarrowing]
解决办法:
添加编译参数: -std=g++98
g++ -o outfile sourcefile.cpp -std=g++98