[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] Const char * changes
From: |
David Benbennick |
Subject: |
[Nano-devel] Const char * changes |
Date: |
Thu, 13 Feb 2003 15:14:04 -0500 |
User-agent: |
Mutt/1.2.5.1i |
Chris,
20 hours ago you committed a change to global.c and winio.c, making lots
of strings "char *" that used to be "const char *". I guess the reason
was that on some systems, the Curses waddstr() function takes a "char *"
instead of a const string. So for example on Solaris, there are a few
warnings about discarding qualifiers.
I think this might not be a great solution. Modifying string constants
like "Chris Allegretta" will cause a segfault, so the waddstr() function
had better act like it gets a "const char *". Also, on ncurses systems
where waddstr() is declared correctly, you now get a lot of warnings with
the -Wwrite-strings option to gcc. -Wwrite-strings warns about
potentially writing to a constant string.
It seems to me much cleaner to use "char *" only for malloc()ed strings,
which have to be freed, and to use "const char *" for literal strings,
which can't be modified anyway.
pgp5Du1IsxJMk.pgp
Description: PGP signature
- [Nano-devel] Const char * changes,
David Benbennick <=