Re: GCC difference in size of 'long int' on Suse SLES9 / Suse Professional 10.0
- From: Ian Hilliard <nospam@xxxxxxxxxxxxxxxx>
- Date: Sat, 12 Aug 2006 18:45:51 +0200
Toni Erdmann wrote:
Hello *,
I have a problem compiling an application for 2 different platforms:
1.) Dual Opteron SUN V20z with Suse Professional 10.0
2.) Dual XEON FSC RX200 with SLES 9
I seems to me that the size of a 'long int' is
1.) 4 bytes
2.) 8 bytes
which makes it difficult to have one executable for both
systems.
I did not find an option for 'gcc' (on x86) to force a length
of 8 bytes.
- is it simply the "#define __WORDSIZE .." definition in
/usr/include/bits/wordsize.h?
- are there other dependencies (libc interfaces)?
- at least, do I have to compile two executables, one for
each platform?
- application is sar/sadc of sysstat which reads some
information from /proc/... files into internal structures.
The kernel uses printf() with 'long int', sadc uses
sscanf() ro read it into 'long int'.
For values > 2**32 this does not work correctly,
when the kernel uses 8 bytes 'long int' and sadc uses
4 bytes 'long int'.
- I can't use the installed sysstat package (version < 5.1.5),
because this one has a bug on SMPs. I must not install a
newer package version. I use the 2 binaries of 7.0.0 in a
private directory.
- I can't compile 'on-the-fly'. 'gcc' might not be installed.
- using '__uint64_t' instead of 'unsigned long int' would be the
best, but this would take too much time. I will contact the
maintainer for this issue.
Thanks for any hints,
Toni
Having come from the embedded world, where is was necessary to run on a lot
of different platforms with a lot of different compilers, I set up my own
types.h file (In my case HTypes.h). In there I define all my standard
types, i.e. uint8, sint8, uint16, sint16,... up to uint64 and sint64. I
then code with these types.
Because of these definitions are a part of the abstraction layer for a
particular OS compiler combination, I have very few problems moving from
one platform to another, including between Windows, Linux and Solaris.
There is a general design rule that states that all external interfaces
should be over a single point of access. Unfortunately, many programmers
forget that the OS is also an external interface.
Ian
.
- Prev by Date: Re: nohup question
- Next by Date: tcp server implementation
- Previous by thread: Re: GCC difference in size of 'long int' on Suse SLES9 / Suse Professional 10.0
- Next by thread: Re: GCC difference in size of 'long int' on Suse SLES9 / Suse Professional 10.0
- Index(es):
Relevant Pages
|
|