#5550 closed defect (fixed)
Different size of long on windows / linux systems
Reported by: | Owned by: | Martin Sjölund | |
---|---|---|---|
Priority: | low | Milestone: | 1.17.0 |
Component: | Code Generation | Version: | v1.14.0-dev-nightly |
Keywords: | Cc: |
Description
Hi,
I have the problem, that the same metamodelica code on different os gives different results:
function intSize output Integer j = 0; protected Integer i = 1; algorithm while i > 0 loop j := j + 1; i := i * 2; end while; print(j); end intSize;
On a windows system the value of j is 31 and on a linux system the value is 63. e.g. This is a problem using the hash function.
As far as I could see, this happens because of the different length of the c type long on different os.
openmodelica_types.h defines
typedef long m_integer
I suggest to use long long for the windows version.
Change History (4)
comment:1 by , 6 years ago
comment:2 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 4 years ago
Milestone: | Future → 1.17.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
comment:4 by , 4 years ago
Summary: | Different size of long on windows / linus systems → Different size of long on windows / linux systems |
---|
Note:
See TracTickets
for help on using tickets.
Those are for the Modelica side, and yes, it seems like a bug.
For MetaModelica we should have 63bit integers for 64bit Windows installer and 31bit integers for the 32bit one:
https://github.com/OpenModelica/OpenModelica/blob/master/OMCompiler/SimulationRuntime/c/meta/meta_modelica_data.h#L81
We use mmc_sint_t and mmc_uint_t for MetaModelica.