--- In [email protected], "izecksohn" <izecks...@...> wrote:
>
> --- "johnmatthews2000" <jm5678@> wrote:
> > 
> > No need to complicate things with a pointer - just use:
> > 
> >   const char filename[] = "rebase_stats.txt";
> 
>   The following is why I code this way:
> http://www.izecksohn.com/pedro/c/*%20versus%20%5B%5D/test.c

So I think you are saying you use code which is more complicated than it needs 
to be because, if you do something silly (in this case use a cast to remove the 
const), the program is more likely to crash?

It's good that you are using defensive techniques, but this shouldn't take 
priority over writing clear and 'correct' code. The crash behaviour is 
implementation-specific anyway - it might not crash at all on one 
machine/compiler, and both cases might crash on another.

Having said that, replacing:

    const char string[] = "Hello";

with:

    static const char string[] = "Hello";

also results in a crash on my machine, and doesn't require a pointer.

Reply via email to