Re: Comedi use of standard types

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

 



On Thu, Feb 23, 2017 at 07:48:59AM +1100, Tobin C. Harding wrote:
> On Wed, Feb 22, 2017 at 04:51:05PM +0300, Dan Carpenter wrote:
> > On Wed, Feb 22, 2017 at 11:46:07AM +0000, Ian Abbott wrote:
> > > On 21/02/17 21:27, Tobin C. Harding wrote:
> > > >Comedi drivers make heavy use of standard types i.e unsigned
> > > >short. According to Linux Device Drivers standard C data types are not
> > > >the same size of all architectures.
> > > >
> > > >Should we be converting comedi/drivers to use kernel types u8, u16 etc
> > > 
> > > Linux kernel C data types have stricter requirements than the C
> > > standard allows.  There is common agreement on the widths of 'char',
> > > 'short', 'int', and 'long long', a choice of two widths for 'long'.
> > > Signed integers are assumed to use 2's complement representation,
> > > and null pointers are assumed to have an "all bits zero"
> > > representation. Obviously, the "endianness" of the types will be
> > > arch-specific.  (I probably missed some stuff.  For example, I'm not
> > > sure if the Linux kernel requires a plain 'char' to be signed.  And
> > > I don't know if any of this is officially documented anywhere, so
> > > count it as my opinion.)
> 
> Thanks for clarifying. So, as I understand it now, as far as kernel
> code goes;
> 
> u8 <=> unsigned char
> u16 <=> unsigned short
> u32 <=> unsigned int
> u64 <=> unsigned long long
> 
> (where <=> means 'is equivalent to')

Yeah.  But they sort of communicate different things.  It's just like
we don't remove all the synomym duplicates from the English language.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux