You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the base for this mapping is https://en.wikipedia.org/wiki/C_data_types which is based on the c standard. the problem on these mapping are, they do not account for the data model the system uses.
For example a long int has to be, according to the standard at least 32bit, but on today's 64bit processors it's 64bit as well. at least on x86_64-linux-gnu, a int64_t is defined as long int and not, as one may expect, as long long int. therefor c-for-go translates this int64_t to golang's int32 instead of int64.
I suggests the translations map should also consider the data model the user expect to use. There's already an Arch settings in the yaml file which may be used. Maybe an OS setting is also needed. For a definition on data models and datatype size, the cpp reference provides a overview at https://en.cppreference.com/w/cpp/language/types
fortunately modernc.org/cc already has this information. An uptate to
v4.1.0 is needed as otherwise ABI.Types is not public.
Issue: xlab#138
Signed-off-by: Martin Gysel <me@bearsh.org>
fortunately modernc.org/cc already has this information. An uptate to
v4.1.0 is needed as otherwise ABI.Types is not public.
Issue: xlab#138
Signed-off-by: Martin Gysel <me@bearsh.org>
c-fo-go has a fixed type mapping to map c types to go types. this is defined in
c-for-go/translator/type_mapping.go
Line 53 in eaf8c81
the base for this mapping is https://en.wikipedia.org/wiki/C_data_types which is based on the c standard. the problem on these mapping are, they do not account for the data model the system uses.
For example a
long int
has to be, according to the standard at least 32bit, but on today's 64bit processors it's 64bit as well. at least on x86_64-linux-gnu, aint64_t
is defined aslong int
and not, as one may expect, aslong long int
. therefor c-for-go translates thisint64_t
to golang'sint32
instead ofint64
.I suggests the translations map should also consider the data model the user expect to use. There's already an Arch settings in the yaml file which may be used. Maybe an OS setting is also needed. For a definition on data models and datatype size, the cpp reference provides a overview at https://en.cppreference.com/w/cpp/language/types
see also #120
The text was updated successfully, but these errors were encountered: