Comedi use of standard types
Dan Carpenter
dan.carpenter at oracle.com
Wed Feb 22 13:57:01 UTC 2017
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
More information about the devel
mailing list