[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-cxx-dev
Subject:    RE: CXX-DEV: Deprecated string constants
From:       "Jason Botwick" <Jason.Botwick.jdbotwic () nt ! com>
Date:       1998-07-29 17:42:33
[Download RAW message or body]

I agree with the poster who suggested that you use the string class that
comes with aCC. It's robust, flexible and it will allow you to work in a
more intuitive way with strings and constant strings.

> ----------
> From: 	Robert Kerr[SMTP:kerrr@et.byu.edu]
> Sent: 	Tuesday, July 28, 1998 6:09 PM
> To: 	HP C++ List
> Subject: 	CXX-DEV: Deprecated string constants
> 
> Hi all,
> 
> I've been working on getting our code up to aCC standards, and we are
> encountering a problem.  We have a set of strings and with them we want to
> 
> 
> a) be able to initialize the name with a string literal, and
> b) be able to change the value of the name during execution.
> 
> I have been scrupulously putting a const in all the areas where they are
> needed, but then I'm hitting a problem with b) from above.  Currently the
> line that gives us problems is strcpy(oldstring, newstring).  oldstring
> has been declared as a char* in a structure.  Now, the warning about
> assigning a string literal to a char * can be fixed by making oldstring a
> const char *, but then strcpy has a problem (and rightly so).
> 
> So, my question is, is there a way to work around this so I can get rid of
> both types of problems?
> 
> Thanks
> 
> -bob
> 
> UNIX _IS_ user friendly, it's just picky about who its friends are.
> **********************************************************************
> * Robert Kerr, The morphing guy.  *    MS 0441 Sandia National Labs  *
> * rakerr@sandia.gov               *    Albuquerque NM 87185-0441     *
> * Robert_Kerr@byu.edu             *      Phone: (505) 844-8606       *
> * http://www.et.byu.edu/~kerrr    *      Fax: (505) 844-9297         *
> **********************************************************************
> 
> 
> 
>  _________________________________________________________________
>  To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
>     with the message UNSUBSCRIBE cxx-dev
>  To reply to the list, send mail to cxx-dev@cxx.cup.hp.com
>  _________________________________________________________________
> 
 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE cxx-dev
 To reply to the list, send mail to cxx-dev@cxx.cup.hp.com
 _________________________________________________________________

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic