Re: Comedi use of standard types

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

 



On Wed, Feb 22, 2017 at 04:51:05PM +0300, Dan Carpenter wrote:
> > >Is the choice (size) of type in a struct (eg struct ni_private,
> > >comedi/drivers/ni_stc.h) a kernel design issue or is it a hardware
> > >issue and should I be reading the manual to find it.
> > 
> > It's mostly a design issue.  In general, there is no harm in making
> > local variables wider than they need to be up to 'int' size,
> > although the exact-width types such as 'u16' may be useful
> > sometimes.  In general, structure members and array elements should
> > not be excessively wide.  The use of 'long' or 'unsigned long'
> > should be viewed with suspicion unless there is a specific reason
> > for it.
> 
> Long and unsigned long are fairly normal types used everywhere.
> 

In user visible structures then you do have to be a lot more careful
with longs.  But ni_private is private.  I don't see anything in
ni_private that is the least bit ambiguous.

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