Re: warning that warns about iso compliant code

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

 



Hi Burlen,

> To me it seems the compiler should not warn about code that follows the
> ISO standard rules. However, it would be nice if the compiler warned
> about the case that didn't follow the standard. I personally like to
> hide the outer variables because it documents the fact that a particular
> loop does not use that variable. Am I just being silly and I should use
> different index variable name for all of my nested loops,even when there
> are no dependencies?

In general, from a software engineering point of view, I recommend to avoid
shadowing variables.

If someone changes something, they may miss a change, and then the shadowed
variable incorrectly becomes the live variable, and the compiler can't help
you out.

However, I think your concern is quite valid, and that the compiler should
not be warning about this issue for ISO 14882 compliant code unless you have
explicitly enabled the noisy cricket warning.  (In my code, I would
definitely enable that noisy cricket warning, and fix them.)

Hmmmm.  What is the -Wfoo flag or -Wno-foo flag for this warning?

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux