Conversion from COMPREAL to REAL and float

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.

double rval=0.0;

case ADJTM_FUNC :
rval = ADJTM(val[0].vec->vals, (L1150)
val[1].vec->vals, (L1151)
val[2].vec->vals, (L1152)
val[3].val, (L1153)
val[4].val, (L1154)
val[5].val, (L1155)
val[6].val, (L1156)
val[7].val, (L1157)
val[8].val, (L1158)
val[9].val, (L1159)
val[10].val); (L1160)
break;

Warning messages

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
There doesn't seem to be enough information here.
Can you upload venext.c somewhere (like https://filebin.net/ ) and post a link?
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.
Last edited on
Topic archived. No new replies allowed.