Search code examples
cx11const-char

How come XDrawString doesn't take "const char *"?


looking at the declaration for XDrawString from X11, it is

int XDrawString(Display *display, Drawable d, GC gc,
                int x, int y, char *string, int length);

How come the 6th argument is type "char *" instead of "const char *"? Does drawing the string require modifying it? I've seen lots of examples where people pass in constant strings; is that unsafe?


Solution

  • Either because the function has been around since before const or because those who designed the API have troubles keeping up.