Char array truncation
Posted: Mon Aug 29, 2011 9:34 pm
Hi,
I have an array with scancodes in it. It is defined like this:
'ubyte' is just a typedef for 'unsigned char'
When I compile (VS 2010), I get this error:
I'm reasonably sure this happens because there are escape codes, such as '\\' and '\'', and the compiler thinks I'm putting strings in the array.
It does work correctly, despite the warning. However, I would like a clean compile output. Is there a better way to do this, or is it best to just put up with the error?
I have an array with scancodes in it. It is defined like this:
Code: Select all
ubyte keymap[128]
When I compile (VS 2010), I get this error:
Code: Select all
keymap.h(18): warning C4305: 'initializing' : truncation from 'int' to 'ubyte'
It does work correctly, despite the warning. However, I would like a clean compile output. Is there a better way to do this, or is it best to just put up with the error?