Menu

#13 Cross-platform compatibility.

open
nobody
None
5
2012-10-25
2006-09-12
No

For cross-platform compatibility, it would be nice to
have all the integer data declared as defined in the
stdint.h header (int8_t, int16_t, int32_t, uint8_t,
uint16_t, uint32_t).
For example, I am working on a platform in which int is
16 bit and long int is 32 bit (64 bit not supported).
In case I have more than 2^16 tests, some counters go
overflow because they are declared as int or unsigned int.

Then, the fprintf calls that contain integer values
should be written conditionally. Following my example,
an integer value declared as int32_t has to be
indicated to fprintf with the descriptor %ld instead of
%d: in fact, in my case, int32_t is large as two int.

More in general, I would like to focus your attention
on cross-platform compatibility issues.

Discussion

  • Roberto Bonacina

    Logged In: YES
    user_id=1596269

    I tried to find a better approach to both the specific
    requests I reported before. Here it is: given that a long is
    at least 32 bit, all the variables needed to be 32 bit
    should be declared as long (or unsigned long). Then, the
    fprintf calls have no need to be conditional: they just use
    the %ld (or %lu) descriptor when a long has to be printed.
    I have made myself the changes in all .c and .h files,
    except for Win and Curses, basing on ver. 2.1-0 (a few other
    changes are in). Please let me know if my files could be of
    your interest, to have the work (almost) done.

     
  • Martin Gerhardy

    Martin Gerhardy - 2010-10-23

    please attach your work as a patch

     
  • Roberto Bonacina

    I have made a patch that substitutes almost all the int with long. The patch, called longPatch.patch, has been made against the current repository revision (156), in the trunk directory.

     
  • Roberto Bonacina

    Patch that substitutes int with long.

     

Anonymous
Anonymous

Add attachments
Cancel