|
|
|
Re: including sparse headers in C++ code | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Mit, 2010-10-20 at 00:49 +0200, Tomas Klacko wrote:
> On Tue, Oct 19, 2010 at 11:31 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> > On Tue, Oct 19, 2010 at 10:03:42PM +0200, Tomas Klacko wrote:
>
> >> static inline int match_op(struct token *token, int op)
> >> {
> >> - return token->pos.type == TOKEN_SPECIAL && token->special == op;
> >> + return token->pos.type == TOKEN_SPECIAL && token->special == (unsigned int)op;
> >
> > What was that one for?
>
> "warning: comparison between signed and unsigned integer expressions"
Add "-Wsign-compare" to the CFLAGS (for a pure C compile) and you will
find many more of them.
IMHO it needs a decision if the goal is to prefer signed or unsigned int
(where no negative values ever used/assigned) and convert struct members
and/or global variables. Most of them TTBOMK are never negative anyways.
For the "C vs C++" issue: if you have an enum, the rules (or at least
the reality defined by gcc) are subtly different if it's a signed int or
an unsigned int and the values of their members.
Bernd
--
mobile: +43 664 4416156 http://www.sysprog.at/
Linux Software Development, Consulting and Services
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Newbies FAQ] [Kernel List] [Site Home] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [Bugtraq] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [DDR & Rambus] [Trinity Fuzzer Tool]