[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cmocka under x86-64-w64-mingw32


__WORDSIZE is 64, but sizeof(unsigned long int) is 4 to be compatible with
Windows ABI.

http://stackoverflow.com/questions/7607502/sizeoflong-in-64-bit-c

On Wed, Aug 5, 2015 at 7:29 AM, Lukas Slebodnik <lslebodn@xxxxxxxxxx> wrote:

> On (05/08/15 06:59), Dejan Črnila wrote:
> >I'm trying to use cmocka under 64 bit mingw compiler. However it silently
> >fails.
> >
> >I have tracked down the issue to these lines in cmocka.h
> >
> ># if __WORDSIZE == 64
> >#  define LargestIntegralType unsigned long int
> ># else
> >#  define LargestIntegralType unsigned long long int
> ># endif
> >
> >shouldn't be the other way around?
> I don't think so.
> You can try with sizeof operator.
>    sizeof(unsigned long int) << should return 4 on 32 bit architecture
>                                 and it should return 8 on 64 bit
> architecture
>
> It's not guaranted by C standard but it works on linux platforms.
>
> What is a sizeof(unsigned long int) under 64 bit mingw compiler?
> Is macro __WORDSIZE defined?
>
> LS
>



-- 
Dejan Crnila,
Software engineer,
Dewesoft d.o.o.

Follow-Ups:
Re: cmocka under x86-64-w64-mingw32Lukas Slebodnik <lslebodn@xxxxxxxxxx>
References:
cmocka under x86-64-w64-mingw32Dejan Črnila <dejan.crnila@xxxxxxxxxxxx>
Re: cmocka under x86-64-w64-mingw32Lukas Slebodnik <lslebodn@xxxxxxxxxx>