Mail Archives: djgpp/1999/09/07/08:56:40
In article <Pine DOT SUN DOT 3 DOT 91 DOT 990906190544 DOT 12553A-100000 AT is>, djgpp AT delorie DOT com wrote:
>
>On Mon, 6 Sep 1999, Manni Heumann wrote:
>
>> The C library was also written in C. Nevertheless functions like printf take
> a
>> const char* as their first argument.
>
>The library sources sometimes need to go to great lengths to do this,
>because the compiler doesn't like it when you take a const char * and
>pass it to a function that accepts a char *. If a library function needs
>to call another library function, it might be a royal PITA to struggle
>with these problems. Download djlsr202.zip and search for "unconst" to
>see what I mean.
>
>This is what Shawn meant when he said that const tends to propagate
>through the entire source.
I see your point.
But the problem is there anyway. It's either the developer or the user of the
library who has to deal with it. And since 2.95 it got serious, because
sources that pass something supposed to be const to a non-const function will
no longer compile.
So if you are programming in C++ and use strings you will have to resort to
some ugly hacks in your code.
It seems the problem really is in the varargs macros and Shawn is off the
hook, so the question seems to be what the C++ guys want to do about all this.
Suggestions, anybody?
--
Manni
- Raw text -