On 08/10/15 19:07, Graeme Gregory wrote:

Fixed qltools is here

https://github.com/slimlogic/qltools

Thanks Graeme, I've been looking for a decent version of qltools for some time to use on Linux.

David - if you are interested - the reason that qltools.c won't compile without warnings on Linux is because the original code used various typdefs from stdint.h, which, for example, defines the following:

typedef unsigned int            uint32_t;

So, the unit32_t assumes that an unsigned int is 32 bits.

The C99 standard introduced those as actual types so that a uint32_t is always guaranteed (!) to be 32 bits. In order to printf() those, this now gives a warning:

printf ("Updates : %ld\n", swaplong (b0->q5a_mupd));

simply because the "%ld" is the format specifier for a long int and not for a uint32_t. In order to get rid of the warnings, you need to either:

#include <inttypes.h>
...
printf ("Updates : %" PRIu32 "\n", swaplong (b0->q5a_mupd));


or, simply change the "%ld" specifier to "%u" for a simple unsigned int.


I think the later/latest versions of gcc defaults to c99, hence all the warnings.

I'm in the middle of going through one of my old programs on Linux to replace all the "%lu" etc with the appropriate c99 specifiers rather than just making them all "%u". It should then be future proof! Famous last words.


HTH

Cheers,
Norm.


--
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
27a Lidget Hill
Pudsey
West Yorkshire
United Kingdom
LS28 7LG

Company Number: 05132767
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to