bug-ncurses
[Top][All Lists]
Advanced

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

possible const problem, mvwprintw


From: D. Stimits
Subject: possible const problem, mvwprintw
Date: Sun, 15 Jun 2003 18:52:06 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021018

I came up with an interesting dilemma, under ncurses 5.3-4 (RPM package, RH 7.3).

The prototype in /usr/include/curses.h (a sym link to /usr/include/ncurses/curses.h) for mvwprintw() has argument 4 properly prototyped as "const char *". However, when I pass a truly const char* as this argument, I get an error (I'm actually using g++ with extern "C" wrapper, many C compilers probably won't burp on it unless the const char* is actually modified...i.e., at runtime, or possibly if set by compile flag to act strictly in such cases). The error tells me it can't convert my const char* to char*, as if the function mvwprintw had been declared with non-const argument 4.

When I look at /usr/include/ncurses/curses.h, argument 4 is declared const, so I can't at first see how this error is happening. However, it looks like "under the covers" this is really a macro, and in llib-lncursesw, it has this:
#undef mvwprintw
int     mvwprintw(
                WINDOW  *win,
                int     y,
                int     x,
                char    *fmt,
                ...)
                { return(*(int *)0); }

Apparently mvwprintw is initially a macro. The file naming seems odd to me, I'd expect a .c or .h. Well, the conclusion here is that the fmt argument, in this file, is inappropriately changed back from const to non-const. In fact, there are a lot of non-const char* fmt lines in that file. How is this non-.c/non-.h file being used? Is awk or some other tool writing other files after scanning this one? Can these non-const char* fmt arguments be patched to use const char*? Or am I looking at something completely irrelevant as the cause to rejecting const char* in mvwprintw as the fmt?

D. Stimits, stimits AT attbi DOT com





reply via email to

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