Opened 12 years ago

Last modified 11 years ago

#1974 new enhancement

Types in the OMC compiler

Reported by: adrpo Owned by: adrpo
Priority: low Milestone: Future
Component: Build Environment Version: trunk
Keywords: Cc: sjoelund.se

Description

Maybe we should switch all the f2c types from
int to long so they are the same size as void*
on different platforms.

Also, it might be a good idea to have
our own types everywhere in the compiler.
Have a new header omc_types.h where we
define all the types we need and we use
them everywhere:

  • SimulationRuntime/*
  • Compiler/runtime
  • generated code
  • parser

We have this in openmodelica.h:

#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
typedef int fortran_integer;
typedef unsigned int fortran_uinteger;
#else
typedef long int fortran_integer;
typedef unsigned long int fortran_uinteger;
#endif

"int" is rather bad because it varies in size
on different platform and various issues might
appear because of data loss when casting, etc.

Comments, suggestions? Feel free to comment here.

Change History (1)

comment:1 Changed 11 years ago by sjoelund.se

We cannot switch f2c types from int to long because the type is platform-specific, and we use he f2c.h system header...

Note: See TracTickets for help on using tickets.