lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Not a glitch, but ...

Compiling with Visual Studio 2010 + Warning level 4.

warning C4244: '=' : conversion from '...' to '...', possible loss of data.

some places like:
---  lparser.c (658)  ---------------------------
static void recfield (LexState *ls, struct ConsControl *cc)
{
    // ... some code
    int reg = ls->fs->freereg;                               <<<
warning  freereg is lu_byte

    // ... some code - reg not used !!!

    fs->freereg = reg;  /* free registers */             <<< warning
freereg is lu_byte
}
-----------------------------------------------------

in cases like this - 'reg' can be lu_byte.

+ some places - need explicit type conversion to avoid warnings.

full warning list:

2>------ Rebuild All started: Project: lua52, Configuration: Release x64 ------
2> lapi.c
2> lauxlib.c
2>..\src\lauxlib.c(602): warning C4244: '=' : conversion from 'int' to
'char', possible loss of data
2>..\src\lauxlib.c(650): warning C4244: '=' : conversion from 'int' to
'char', possible loss of data
2> lbaselib.c
2> lbitlib.c
2> lcode.c
2>..\src\lcode.c(273): warning C4244: '+=' : conversion from 'int' to
'lu_byte', possible loss of data
2>..\src\lcode.c(706): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2>..\src\lcode.c(707): warning C4244: '=' : conversion from 'int' to
'short', possible loss of data
2>..\src\lcode.c(880): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2> lcorolib.c
2> lctype.c
2> ldblib.c
2> ldebug.c
2> ldo.c
2>..\src\ldo.c(79): warning C4324: 'lua_longjmp' : structure was
padded due to __declspec(align())
2>..\src\ldo.c(309): warning C4244: '=' : conversion from 'int' to
'short', possible loss of data
2>..\src\ldo.c(333): warning C4244: '=' : conversion from 'int' to
'short', possible loss of data
2>..\src\ldo.c(465): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2> ldump.c
2> lfunc.c
2> lgc.c
2>..\src\lgc.c(224): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2>..\src\lgc.c(784): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2>..\src\lgc.c(1095): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2> linit.c
2> liolib.c
2> llex.c
2> lmathlib.c
2> lmem.c
2> loadlib.c
2> lobject.c
2> lopcodes.c
2> loslib.c
2> lparser.c
2>..\src\lparser.c(441): warning C4244: '=' : conversion from 'int' to
'short', possible loss of data
2>..\src\lparser.c(442): warning C4244: '=' : conversion from 'int' to
'short', possible loss of data
2>..\src\lparser.c(675): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2>..\src\lparser.c(868): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2>..\src\lparser.c(1123): warning C4244: '=' : conversion from 'int'
to 'lu_byte', possible loss of data
2>..\src\lparser.c(1128): warning C4244: '=' : conversion from 'int'
to 'short', possible loss of data
2>..\src\lparser.c(1161): warning C4244: '-=' : conversion from 'int'
to 'lu_byte', possible loss of data
2> lstate.c
2> lstring.c
2> lstrlib.c
2>..\src\lstrlib.c(86): warning C4244: '=' : conversion from 'int' to
'char', possible loss of data
2>..\src\lstrlib.c(99): warning C4244: '=' : conversion from 'int' to
'char', possible loss of data
2> ltable.c
2> ltablib.c
2> ltm.c
2> lundump.c
2>..\src\lundump.c(139): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2>..\src\lundump.c(140): warning C4244: '=' : conversion from 'int' to
'lu_byte', possible loss of data
2> lvm.c
2> lzio.c
-------------------------------------------------


Thanks