------- Comment #6 from gdr at integrable-solutions dot net  2006-10-24 06:32 
-------
Subject: Re:   New: Issues with -Wchar-subscripts

"h dot b dot furuseth at usit dot uio dot no" <[EMAIL PROTECTED]>
writes:

| [This is both a C and C++ bug report, not sure how to classify that.]
| 
| int a[256];
| int A(char c) { return a[c];      } // C and C++ warnings, OK.

OK.

| int D(void)   { return a['%'];    } // Spurious C++ warning, no C warning

The absence of warning in C is OK -- literal characters have type int
in C.  The warning in C++ is arguably bogus because the value of the
character '%' is known at compile-time, consequently the warning is
unwarranted (unless it really is negative).

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29455

  • [Bug c++/29455] Issues with -W... gdr at integrable-solutions dot net

Reply via email to