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

Tim Ruehsen <tim.ruehsen at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tim.ruehsen at gmx dot de

--- Comment #3 from Tim Ruehsen <tim.ruehsen at gmx dot de> 2012-02-23 14:12:00 
UTC ---
Just to clarify it and to add a complete program.

#### x.c ####
void f(const char *const *args) {}

int main(int argc, char **argv) {
        f(argv);
        return 0;
}
####

Compiling with g++ (4.6.2) will do without warning.
Compiling with gcc (4.6.2) gives:

x.c: In function 'main':
x.c:4:2: warning: passing argument 1 of 'f' from incompatible pointer type
[enabled by default]
x.c:1:6: note: expected 'const char * const*' but argument is of type 'char **'


This is somewhat annoying when trying to harden older C sources with
-Wwrite-strings.
One has to insert (very) many casts to avoid the above warning.
This is much work that could be avoided by an apropriate -W option.

Reply via email to