define lfds700_pal_uint_t

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds700
    └───inc
        └───liblfds700
                lfds700_lfds700_porting_abstraction_layer_procesor.h

Typedef

typedef [type] lfds700_pal_uint_t;

Example

typedef int long long unsigned lfds700_pal_uint_t;

Optionality

This typedef is mandatory.

Notes

The library needs an unsigned type which is the natural integer length for the platform, so that for example variables used to count the number of elements in a data structure naturally and inherently provide large number ranges on more capable platforms.

In the C89 standard, there is no such type. It should be that int wors in this way, but it does not, as with Windows and Linux int is 32 bit on 64 bit platforms.

The nearest type there is to this is size_t, but his has a different semantic meaning and anyway, is defined by the Standard Library, and liblfds is written to support C implementations which lack the Standard Library.

I am of the view int should be of the natural integer length for a platform, i.e. 32 bit on 32 bit platforms and 64 bit on 64 bit platforms, and as such both Windows and Linux have it wrong, where they use LLP64 and LP64, respectively, and have int as 32 bit on 64 bit platforms. Obviously it was unavoidable for backwards compatibility with existing code bases.

See Also