[GRASS5] -fwritable-strings

Michel Wurtz - ENGEES/CEREG mw at engees.u-strasbg.fr
Wed Jul 26 07:00:51 EDT 2000


Bernhard Reiter wrote:
> It has nothing to do with GNU/Linux.
> Only with old programs doing stuff like:
> 
>         char * x="Heino";
>         x[2]='o';
> 
> Because the compiler with place &x in protected memory which is not
> writable usually.

Yes, the correct declaration should be :

char x[]="Heino";

because the variable you can modify is yet the character table, and
not the pointer to a static chain.
It should be easy to upgrade, unless you do something like

x = "another chain";

further in the program... In this case, x must be a pointer and the
first declaration should be used (char *x;) !

-- 
Michel Wurtz    ENGEES - CEREG
                1, quai Koch - BP 1039, F-67070 STRASBOURG cedex
                Tel: +33 03.88.24.82.45  Fax: +33 03.88.37.04.97

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list