[Bug c/20422] warning: passing arg 1 of `mymalloc' from incompatible pointer type

falk at debian dot org gcc-bugzilla@gcc.gnu.org
Fri Mar 11 10:36:00 GMT 2005


------- Additional Comments From falk at debian dot org  2005-03-11 10:36 -------
(In reply to comment #0)

> Opinion:
>     The default set of warnings for gcc is not sane, and
>     eventually causes lower quality code.

The default does not follow "sanity", but it follows the C standard. The
reason is that opinions about sanity are not exactly unambiguois, while the C
standard is (well, mostly). I can demonstrate this nicely:

>     The mymalloc(&pString, 255) call in above sample is valid
>     and good, and should not yield a warning.

In my opinion, it should; the standard does not allow this, and people
might want to use pedantic compilers.

> Rationale 2:
>     The gcc compiler does not make a distinction between
>     the good mymalloc(&pString, 255) and the bad
>     mymalloc(pString, 255).

In my opinion, that's a good thing. It's a *very* established C idiom
that a cast means the compiler is not to warn.

In my opinion, we should close this as invalid.


-- 


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



More information about the Gcc-bugs mailing list