Re: [PATCH] eliminate insane conversions from int to enum

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

 



On Sat, Mar 27, 2010 at 2:53 AM, Kamil Dudka <kdudka@xxxxxxxxxx> wrote:
> On Saturday 27 of March 2010 10:29:50 Josh Triplett wrote:
>> > Here is what sparse gives:
>> > $ ./sparse enum.c
>> > enum.c:1:10: warning: non-ANSI function declaration of function 'main'
>> > enum.c:6:15: warning: conversion of
>> > enum.c:6:15:     int to
>> > enum.c:6:15:     int enum <noident>
>> >
>> >
>> > Here is what g++ gives:
>> > $ g++ enum.c
>> > enum.c: In function ‘int main()’:
>> > enum.c:6: error: invalid conversion from ‘int’ to ‘main()::<anonymous
>> > enum>’
>>
>> Yup, both of these warnings seem correct.  Don't fix them by casting,
>> fix them by declaring "val" with an appropriate integral type.
>
> patch attached

I mention that in my other email. I don't agree this is a better change.
It is just for the sake of making the enum warning happy and make code
harder to understand.

Chris
--
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

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux