On Mon Oct 10 18:13:11 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list:
On 10/10/22 05:13, eric pouech (@epo) wrote: > Does it mean you'd rather wait for that migration to happen before considering migating to long types, or you'd favor long type migration by reducing at max the trace/printf changes (so that it doesn't change twice when considering the two migrations). > If the second case, note that: > - it means changing types so that they are the same in lp64 and llp64 (mainly no longer using dword & long, but int:s), example: moving all flags variable / parameters from DWORD to unsigned > - but some plzces will could still require trace changes (eg NSTATUS or GetLastError where I think it s better to keep the windows type for clarity) I think it would potentially make sense to get rid of long-typed variables in wined3d, though this gets a bit awkward, since e.g. DWORD is propagated in some places from the public interface, and HRESULT is relatively semantically charged. Mostly at this point I'd just advocate inaction. > - it's not very clear what would be preferred between using unsigned vs. uint32_t vs UINT. Current code uses the three forms but couldn't find out a pattern on when to use which. UINT should probably be replaced with unsigned int. uint32_t would, I think, be preferred when something does specifically need to be 32 bits (e.g. I would prefer it to DWORD for shader token parsing).
I had started writing a reply to this, but Zeb answered before I finished it. Anyway:
it's not very clear what would be preferred between using unsigned vs. uint32_t vs UINT. Current code uses the three forms but couldn't find out a pattern on when to use which.
It's not consistent because there's quite some amount of older code inside wined3d, but in principle:
* Array sizes and similar quantities like resource map ranges that in principle are limited by the address space of the process use `size_t`. * Explicitly 64-bit variables use `uint64_t`. There aren't very many of these; mostly things like Vulkan command buffer IDs or fence IDs. * Fixed-width variables like flags, masks, bitmaps, etc. use `uint32_t`. * Signed types are rare; in general integer variables are unsigned unless they can legitimately take on negative values. * Loop counter types are generally dictated by the thing they're iterating over; typically these should be `size_t`. * General integer types use `unsigned int`. Typically these are things we pass from D3D to OpenGL or Vulkan in one form or another. * We generally avoid Win32 types like `DWORD`/`UINT`/`ULONG`/`WORD`/`BYTE` in new code, preferring the standard C89/C99 types where possible.