[PATCH vkd3d 02/12] vkd3d-shader/hlsl: Pass field to add_record_load() via index.

Giovanni Mascellani gmascellani at codeweavers.com
Tue Jul 5 10:22:14 CDT 2022


Il 05/07/22 17:15, Francisco Casas ha scritto:
> I can do it but I would have to return a magic value (I am thinking on 
> -1) when the field is not found, given the current uses of 
> get_struct_field().

As Henri said, you can return a pointer (which gives you the NULL value 
to signal a missing field) and then use pointer arithmetic to work out 
the index.

Returning -1 is also fine for me, I don't know if that's acceptable in 
vkd3d.

Personally I would try to avoid pointers-as-return-values when possible.

Giovanni.



More information about the wine-devel mailing list