bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: color in subwindows


From: D. Stimits
Subject: Re: color in subwindows
Date: Tue, 17 Jun 2003 12:41:53 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021018

Thomas Dickey wrote:

On Tue, Jun 17, 2003 at 06:27:26AM -0400, Thomas Dickey wrote:

>On Mon, Jun 16, 2003 at 08:46:46PM -0600, D. Stimits wrote:
>
>>>>PS: What are the chances that the wprintw family can be fixed to keep
>>>>the fmt const char* instead of just char*? I know curses.h says they are
>>>>const, but the actual functions are throwing the const away (according


they're const in my current code as well (I was responding to the general
topic, which has come up more than once, but did not notice that this was
one that was no longer an issue).  This particular case is the one that
someone from NetBSD got someone from X/Open to bless a few years ago.


>>Basically, if a parameter to a function is not going to be modified, it
>>should be const in the function declaration. From the man page, and from
>>the curses.h  file, it claims it is const already for the fmt parameter:
>
>I missed some of those (people report a few each year).
>
>
>>   int printw(const char *fmt, ...);
>>   int wprintw(WINDOW *win, const char *fmt, ...);
>>   int mvprintw(int y, int x, const char *fmt, ...);
>>   int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...);
>>   int vwprintw(WINDOW *win, const char *fmt, va_list varglist);
>>   int vw_printw(WINDOW *win, const char *fmt, va_list varglist);
>
>here's the reference:


however, this is not a good case to argue about (since the manpage and curses.h both state that it is const). I'll have to lookup one of the cases that was
giving me trouble (no time right now - sorry).


Fair enough. One argument (no pun intended) I'll add is that a "const char *" fmt argument does not violate a "char *" spec if the fmt argument is not modified. Tell me who to petition for the curses spec, and I'll start hounding them to make the non-modified arguments const...non-const pointers in this case are just bad practice that the older C code won't care about unless const warnings are turned on (and a specification should care about every warning). In any case, the ncurses man pages say fmt is a const, but the actual implementation is NOT a const due to redefinition of the <curses.h> header (the installed <curses.h> header is not the source of the non-const, and if the header were not redefined in the implementation to be non-const, things would be perfect).

D. Stimits, stimits AT attbi DOT com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]