--- In [email protected], Thomas Treyer <[EMAIL PROTECTED]> wrote:
>
> Hi Geert,
>
> in errno.h you defined all the different error values beginning with
> EI2CBUSNFREE 1
>
> This confused me a little bit, because this overlaps with the error
> EINVAL, which is used by i2c_ioctl() also and has the value of 1
> also. Maybe it would be better to shift the error numbers a little
> bit. What is your opinion?
>
Hi Thomas,
First of all, and that's an important issue, the file is called
i2c_errno.h, not errno.h.
If those constants would have been in the same header file, then I
would definitely agree with you. But since they're now in a separate
file and since they have an "unique" character (due to the addition of
a EI2C-prefix), I don't think that should be a problem.
In fact, you're not supposed to know which value is assigned to
whatever #define, neither in errno.h, nor in i2c_errno.h (or in
another header file). You should only use the #defines.
If you rely on the real value and tomorrow someone changes the value
of a #define for one good reason or another, then you're hanging.
Therefore, I think it's perfectly legal to use the same value for
different #defines. If you do comparisons such as
if ( EI2CRCVDATA == ioctl(....) )
then you should not face any problems.
But that's my opinion. Anyone else the same or another meaning?
Like I said in the very first message in this thread: all
suggestions/remarks are welcome. Yours is definitely one that can be
discussed about, but I think I will stick to the current situation for
reasons I gave above.
Hope you agree with me?
Best rgds,
--Geert