Re: libgpiod: rust bindings and bindgen issue with C enums

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

 



On 24-11-22, 21:32, Kent Gibson wrote:
> I don't see this as a problem for generics.  Whether the enum is signed
> or unsigned doesn't need to affect the Error variant, much less the whole
> Error type.  The Error doesn't need to respresent the type of the source
> of the error, it needs to represent the type required to convey
> information to the user.
> Just accepting that the InvalidEnumValue variant expects i32, and casting
> from u32 if necessary, seems appropriate to me.

Right.

> Unless there are some
> extreme values you are concerned about - but then you always switch it
> up to  i64 ;-).

I was just looking to avoid explicit casts, but as you mentioned, it is probably
the right thing to do.

> What is the problem that generics solve - that a subsequent bindgen or
> gpiod.h change might change signage on you?  If so then cast them all
> - even if the cast isn't necessary at present.

That's what I have done here, to avoid future breakage.

Thanks.

-- 
viresh



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux