Re: Program crashes when running it outside dev environment



David Tiktin wrote:
On 08 Jun 2007, Richard Heathfield <rjh@xxxxxxxxxxxxxxx> wrote:

So my suggestions would be:

1) crank up your warning level to the max
2) turn off any extensions you can live without
3) fix every single diagnostic message, and *never* with a cast

I'm with you right up to the last clause. Are you saying you
never actually *need* a cast? Because if you ever really do
need one and forget to put it in and the compiler gives a
diagnostic, you're advice is to... do what? Don't fix it?
I'm sure you don't mean that, since then you'd never compile
without any diagnostics! ;-)

AFAICS the only place you actually NEED a cast is when passing
variables to printf (and similar variadic) functions. Else they
will assume integers are passed.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net



--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: Program crashes when running it outside dev environment
    ... fix every single diagnostic message, and *never* with a cast ... the right way to fix a diagnostic message. ... adding bad code and putting up with a bad warning, ... diagnostics are permitted for other code as well. ...
    (comp.lang.c)
  • Re: Question on accessing structure
    ... fix them. ... cast of pointer to non-equal pointer ... So why does gcc and ms vc++ compiler allowing such code to compiler at ...
    (comp.lang.c)
  • Re: Comments please
    ... > int main{ ... When the compiler gives you an error message, ... wrong, and fix it. ... Remove the cast. ...
    (comp.lang.c)
  • Re: Program crashes when running it outside dev environment
    ... fix every single diagnostic message, and *never* with a cast ... cast is not the right way to fix a diagnostic message. ... warning, I'll live with the bad warning. ... Do you think loss of precision diagnostics are "bad warnings"? ...
    (comp.lang.c)
  • Re: AMD opteron 64
    ... Without the cast, the ... program would have produced diagnostics on *all* C compilers. ... compiler drew his attention to the error. ... > even if the C language itself doesn't survive. ...
    (comp.lang.c)