Pointer arithmetic not detected by -Wall

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed Mar 29 20:38:00 GMT 2000


> I need to specify -Wpointer-arith to get the warning. Most people believe
> that -Wall covers all the cases that can and should be avoided as long as
> gcc can detect them.

You can use -pedantic to have the compiler flag extensions.

> Incrementing void pointers is really bad. HP-UX native CC doesn't even
> compile it. I can imagine compilers that add other value than 1, also "for
> convenience". This means that the risk of generating bad code is very
> high.

Is there a precedent in real life where it lead to bad code? The risk
of dying from cancer is very high, and indeed many people die from
cancer every year. A claim "the risk of losing all hair overnight is
very high" is not very convincing - I have not heard a single case
where somebody lost all hair overnight.

Regards,
Martin



More information about the Gcc mailing list