Erik de Castro Lopo
2017-Jan-15 05:29 UTC
[flac-dev] unsigned int and FLAC__uint32 are used interchangeably
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/
lvqcl
2017-Jan-15 06:43 UTC
[flac-dev] unsigned int and FLAC__uint32 are used interchangeably
Erik de Castro Lopo wrote:>> 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.Ok, Visual Studio doesn't complain if idx is declared as uint32_t.
Erik de Castro Lopo
2017-Jan-15 06:57 UTC
[flac-dev] unsigned int and FLAC__uint32 are used interchangeably
lvqcl wrote:> Ok, Visual Studio doesn't complain if idx is declared as uint32_t.As expected :). Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/