For a project I compile my shaders to binary data and then convert them to a header file that declares the byte code of the shader as a const char array.
However, during compilation I get the following warning:
"conversion from
inttoconst charrequires a narrowing conversion".
Now I normally know why this happens, it's because the compiler thinks the values are of type int, while they are in fact declared as a type of char.
const char base_ps[]={
0x44,0x58,0x42,0x43,0x12 ... etc
When hovering over these values IntelliSense also points out these are casted to an int. For instance, for the value at index 0 it lists (int)0x44.
Is there any work around for this? Obviously I can explicity put (char) everywhere before each value, however I'd have to add an extra step into shader generation for this that parses the header file.
I kind of don't want to suppress the warning either, yet I want warnings treated as errors. Any advice on this?
const char foo[] = "\x44\x58\x42\x43";?'\x44', '\x58', '\x42', '\x43', '\x12'...