Hi:
On Jul 19, 2005, at 17:49, Benjamin Franksen wrote:
do you know any example where you actually need to destructively
update a string,
once you have it constructed?
I think Ben is right here.
The only in-place update of a string that comes to my mind
is toupper()/tolower() type of formatting,
which often can be avoided by leaving the string as-is
and using a compare_ignorecase().
Most of the time (at least in the IOC, but I believe this is true for
most clients, too) strings are merely copied from one place to another,
or else newly constructed from existing pieces.
Exactly right, with the added constraint that you need
a (const char *) somewhere in the copy chain:
callback with new data for a channel
-> copy string as (char *) into display widget
User enters something in text box
-> extract (char *) from widget and pass as EpicsString
to CA 'write' routine.
I think we need to concentrate on the 99% where the string
is a short, contiguous (char *),
instead of the 1% where the string
is 1MB long, stored as non-contiguous 10 byte segments.
I doubt that write access is needed at arbitrary positions. Having the
write position fixed at the end of the string under construction is
general enough for any application I can think of.
Here I think the most common cases are
- sprintf-type formatting of the whole string
- repeated concatenation to the end of the string.
Thanks,
Kay
- Replies:
- Re: Standard String Marty Kraimer
- Re: Standard String Andrew Johnson
- References:
- FW: Standard String Jeff Hill
- Re: FW: Standard String Benjamin Franksen
- Navigate by Date:
- Prev:
Re: FW: Standard String Benjamin Franksen
- Next:
Type descriptor vs. enum Kay-Uwe Kasemir
- Index:
2002
2003
2004
<2005>
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: FW: Standard String Benjamin Franksen
- Next:
Re: Standard String Marty Kraimer
- Index:
2002
2003
2004
<2005>
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|