This is the mail archive of the gcc@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: Wconversion versus Wcoercion


On 11 Jun 2006 10:31:07 -0500, Gabriel Dos Reis <gdr@cs.tamu.edu> wrote:
"Manuel LÃpez-IbÃÃez" <lopezibanez@gmail.com> writes:

| My project is about "risky" coercions in general: assignments,
| operators, prototypes. You can see some (and comment and propose)
| testcases in http://gcc.gnu.org/wiki/Wcoercion .

    void h2(void)
    {
        int i;
        for(i=0; i < sizeof(double); i++);
    }

when the ranges are known to imply no harm, it is irritating to get
the warning.  It is conventional to use int a loop index.

Wsign-compare already emits a warning in this case. As far as I know, there is no way in the front-end to know the ranges. The example, perhaps should show be more evident:

for(i=-10; i < sizeof(double); i++);

This loop executes a total of 0 times.  Yet, the previous testcase has
the benefit to show that currently we cannot know the ranges and we
should emit the warning.

Cheers,
Manuel.

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