This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question on GCC 4.6 and -fpermissive


On Wed, Aug 10, 2011 at 7:22 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 10 August 2011 10:32, Jonathan Wakely wrote:
>>
>> If you don't want warnings about narrowing then use -Wno-narrow, which
>> works for me.
>
> That should have been -Wno-narrowing, which might be new in 4.7
OK, thanks.

This might be useful if the language allows it. Rather than issuing 18
separate warnings on the following - which would require 18 casts:

static const IncTest< __int8 > inc_int8[] =
{
       { 0x00, 0x01, true},
       { 0x01,0x02, true},
       { 0x02, 0x03, true},
       { 0x7e, 0x7f, true},
       { 0x7f, 0x80, false},
       { 0x80, 0x81, true},
       { 0x81, 0x82, true},
       { 0xfe, 0xff, true},
       { 0xff, 0x00, true},
};

Require us to perform the first cast, and then {accept|imply} the type
on the remainder since we specified the type on the first element:

static const IncTest< __int8 > inc_int8[] =
{
       { (__int8)0x00, (__int8)0x01, true},
       { 0x01,0x02, true},
       { 0x02, 0x03, true},
       { 0x7e, 0x7f, true},
       { 0x7f, 0x80, false},
       { 0x80, 0x81, true},
       { 0x81, 0x82, true},
       { 0xfe, 0xff, true},
       { 0xff, 0x00, true},
};

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]