Geoff Hutchison (ghutchis@wso.williams.edu)
Tue, 10 Aug 1999 11:04:13 -0400
loic@ceic.com wrote:
>> ! char *input_str;
>> ! strcpy(input_str, (optind < ac ? av[optind] : ""));
>> ! cgi input(input_str);
>>
>
> I'd say
>
> String input_str(optind < ac ? av[optind] : "");
> cgi input(input_str);
No can do. This discards the const as well. We don't have a const char *
constructor, and even if we did, we'd have to do a copy somewhere. (I'm
not so sure I want to add a String(const char*) just for this purpose
either.
I agree with the standard--you don't want to to let people mess around
with const variables. But you have to be able to discard it somehow! It
seems the only safe way is to use strcpy or equivalent.
-- -Geoff Hutchison Williams Students Online http://wso.williams.edu/------------------------------------ To unsubscribe from the htdig3-dev mailing list, send a message to htdig3-dev@htdig.org containing the single word "unsubscribe" in the SUBJECT of the message.
This archive was generated by hypermail 2.0b3 on Tue Aug 10 1999 - 08:04:56 PDT