Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Ansi -iso > Re: String Theo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 16 of 16 Topic 151 of 215
Post > Topic >>

Re: String Theory

by Marco van de Voort <marcov@[EMAIL PROTECTED] > Apr 18, 2005 at 07:36 AM

On 2005-04-18, Dave Thompson <david.thompson1@[EMAIL PROTECTED]
> wrote:
> On Fri, 8 Apr 2005 20:08:40 +0000 (UTC), Marco van de Voort

(A "Thompson" answering on a C question from ATT. Hmm, ahh phew, the
firstname is wrong:-)

>> > The language C/C++ does not have string functions either, to this
day.
>> 
> C has (since well before C89) and C++ inherits, functions for
> null-terminated strings. Technically these are in the standard library
> and not the core language syntax, except for literals, if that's the
> distinction you're making,

Correct. That was the distinction that I was making. Of course being
in the standard library matters, but the bolted-on feeling remains.

> but as they are standard they are
> officially part of the language(s). Null-terminated has its
> limitations and problems as already discussed elsethread, but they are
> strings and are usable for most purposes.

IMHO not, not after you have used anything better. They are complicated
and
laborintensive to use, and dangerous IMHO. 

That's not to say that string types don't have problems (temp variables
and
excessive copying in some rare scenarario's, IIRC Chuck gave the typical
recursion example though that is easily worked around), but I'll take it
every time, since with nearly all stringtypes, you can always fall back to
a
string<-> array of char conversion if it e.g. is time critical, or. Or
pointer to array of char.

The delphi ansistring stringtype is quite nice, since it eases this
aspect:
- the stringtype identifier contains a pointer to the array
- the size, ref count and allocation size is maintained at negative
offsets
   to p^
- the array of char is null terminated, _but_ the string can contain null
chars too.

These properties make it possible to pass the string directly to a C (
const
char *) type of parameter without conversion. Only danger is that strings
with null chars will be prematurely truncated.

I'm not really deep into the C++ template stringtypes, just heard there
were
some more advanced possibilities with it. Still have to research it, so
I'll
refrain from more comment on that.
 




 16 Posts in Topic:
String Theory
Andy Ball <null@[EMAIL  2005-04-08 15:50:46 
Re: String Theory
CBFalconer <cbfalconer  2005-04-08 16:51:02 
Re: String Theory
John Reagan <john.reag  2005-04-08 18:40:36 
Re: String Theory
Scott Moore <scott.moo  2005-04-08 11:16:03 
Re: String Theory
Andy Ball <null@[EMAIL  2005-04-08 19:30:09 
Re: String Theory
Scott Moore <scott.moo  2005-04-08 13:02:50 
Re: String Theory
Frank Heckenbach <fran  2005-04-12 12:59:17 
Re: String Theory
Marco van de Voort <ma  2005-04-12 13:20:10 
Re: String Theory
Frank Heckenbach <fran  2005-04-19 11:12:47 
Re: String Theory
Marco van de Voort <ma  2005-04-19 11:39:25 
Re: String Theory
Marco van de Voort <ma  2005-04-08 20:08:40 
Re: String Theory
CBFalconer <cbfalconer  2005-04-08 21:49:56 
Re: String Theory
Marco van de Voort <ma  2005-04-09 09:10:49 
Re: String Theory
CBFalconer <cbfalconer  2005-04-09 12:12:06 
Re: String Theory
Dave Thompson <david.t  2005-04-18 05:08:13 
Re: String Theory
Marco van de Voort <ma  2005-04-18 07:36:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 18:26:01 CDT 2008.