drivers/pcd8544/pcd8544.c: fix var lengths#7859
Conversation
| #define ASCII_MIN 0x20 /**< start of ASCII table */ | ||
| #define ASCII_MAX 0x7e /**< end of ASCII table */ | ||
| #define CHAR_WIDTH (6U) /**< pixel width of a single character */ | ||
| #define CHAR_WIDTH (6) /**< pixel width of a single character */ |
There was a problem hiding this comment.
I don't think this change is needed, the previous version is more valid to me.
There was a problem hiding this comment.
Well the (6U) triggers several comparison warnings of different types. IMHO the U should be used when numbers are really high (maybe 16bit wide) to avoid casting errors on 8 bit platforms.
Thus in this case I don't see why it needs to be (6U).
There was a problem hiding this comment.
I am with @aabadie here: I'd prefer leaving the U. IMHO this should not only used with high numbers, but it should be used to mark any unsigned value... So the preferable fix here would be to actually fix the code that uses this define (there are only 2 lines effected...)
There was a problem hiding this comment.
I agree, just a remark: can a width be negative?
There was a problem hiding this comment.
Why to make it unsigned then?
There was a problem hiding this comment.
If there is a problem with the sign when using, it should be modified when using it not here.
|
Ping! |
|
Re-Ping! |
|
@kYc0o you didn't address the comments, so do not ping until you did so. @haukepetersen and @aabadie (and I agree with them) that it should remain |
|
I didn't receive the notifications for this one, sorry. But I don't see why leaving the I really think that we need to address case by case when an unsigned constant is necessary and when it's not. |
And in this case it is :-) |
| #define ASCII_MIN 0x20 /**< start of ASCII table */ | ||
| #define ASCII_MAX 0x7e /**< end of ASCII table */ | ||
| #define CHAR_WIDTH (6U) /**< pixel width of a single character */ | ||
| #define CHAR_WIDTH (6) /**< pixel width of a single character */ |
There was a problem hiding this comment.
If there is a problem with the sign when using, it should be modified when using it not here.
|
Well anyways this was fixed by #7994 . |
While compiling tests/driver_pcd8544 with clang in OS X it discovers several minor issues.
This PR fixes them.