The following code is from a C file: venext.c. It is associated with the simulation software Vensim and helps compile C files into a DLL, for use by a simulation model. ADJTM is one of the C files to be compiled into a DLL. ADJTM has 3 arguments that are arrays and 8 scalar arguments.
Please advise how to resolve the warning messages. They are all associated with conversion from 'COMPREAL' to 'REAL' or float. 'REAL' is a Vensim variant of float.
1>Venext.c
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1150): warning C4133: 'function': incompatible types - from 'COMPREAL *' to 'float *'
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1151): warning C4133: 'function': incompatible types - from 'COMPREAL *' to 'float *'
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1152): warning C4133: 'function': incompatible types - from 'COMPREAL *' to 'float *'
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1153): warning C4244: 'function': conversion from 'COMPREAL' to 'REAL', possible loss of data
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1154): warning C4244: 'function': conversion from 'COMPREAL' to 'REAL', possible loss of data
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1155): warning C4244: 'function': conversion from 'COMPREAL' to 'REAL', possible loss of data
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1156): warning C4244: 'function': conversion from 'COMPREAL' to 'REAL', possible loss of data
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1157): warning C4244: 'function': conversion from 'COMPREAL' to 'REAL', possible loss of data
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1158): warning C4244: 'function': conversion from 'COMPREAL' to 'REAL', possible loss of data
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1159): warning C4244: 'function': conversion from 'COMPREAL' to 'REAL', possible loss of data
1>c:\vensim\venext6\external sub functions\hospital\venext.c(1160): warning C4244: 'function': conversion from 'COMPREAL' to 'REAL', possible loss of data
the pointer ones may actually break something. The first one is about POINTERS being used carelessly, and you should attempt to fix that somehow.
the ones with loss of data MAY be safe to ignore. You can do that all day long in c++
uint64_t derp = 100;
char c = derp; //possible loss of value, cant fit 64 bits into 8 bits. but 100 fits in both, its fine technically. Compiler warns you anyway.
there may not be any fixing the data loss ones. You can silence the warning with a cast, but the loss of data still happens. You need to test whether it matters or not to your program.