[flac-dev] unsigned int and FLAC__uint32 are used interchangeably

Erik de Castro Lopo mle+la at mega-nerd.com
Sun Jan 15 05:29:56 UTC 2017


lvqcl wrote:

> > Ah, missed that because it was MSVC code. They should be `uint64_t`.
> 
> No, sizeof(unsigned long) is always 4 on Windows.
> See http://www.viva64.com/en/t/0012/

Bah! Trust Windows to be different :).

> >> According to MSDN _BitScanReverse*() functions have signatures:
> >> unsigned char _BitScanReverse(unsigned long *, unsigned long);
> >> unsigned char _BitScanReverse64(unsigned long *, unsigned __int64);
> >
> > The `unsigned long` type should be synonymous with `uint64_t` so using
> > `uint64_t` should be safe. Furthermore if they aren't synonymous we
> > *want* that to be a compile error!
> 
> It's synonymous to uint32_t, but if the 1st parameter for  
> _BitScanReverse*()
> functions has 'pointer to unsigned long' type then IMHO it's better to
> simply use unsigned long variable there.

Sorry, I disagree on the idea of using `unsigned long` exactly because
anyone that comes from Unix will assume that is `uint64_t`. Better to
use `uint32_t` which is totally platform independant and unambiguous.


Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the flac-dev mailing list