delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/07/08:56:40

Newsgroups: comp.os.msdos.djgpp
From: manfred DOT heumann AT uni-bielefeld DOT de (Manni Heumann)
Subject: Re: Annoying: const char * in Allegro
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990906190544 DOT 12553A-100000 AT is>
X-Newsreader: News Xpress 2.01
Date: Tue, 07 Sep 1999 08:36:02 GMT
NNTP-Posting-Host: dhcp33-114.uni-bielefeld.de
Message-ID: <37d4ce7c.0@news.uni-bielefeld.de>
X-Trace: 7 Sep 1999 10:36:12 +0200, dhcp33-114.uni-bielefeld.de
Lines: 33
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019