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 13 of 16 Topic 151 of 213
Post > Topic >>

Re: String Theory

by Marco van de Voort <marcov@[EMAIL PROTECTED] > Apr 9, 2005 at 09:10 AM

On 2005-04-08, CBFalconer <cbfalconer@[EMAIL PROTECTED]
> wrote:
> Marco van de Voort wrote:
>> On 2005-04-08, Scott Moore <scott.moore6@[EMAIL PROTECTED]
> wrote:
>> than either in padded or zero terminated form?
>
> They are more expensive in memory allocation.  Many moons ago I was
> using one of the Turbos and I had a recursive routine that included
> some string manipulation.  It didn't even declare any string
> variables.  It proceeded to crash the system with a stack overflow.

How? If I declare a string everywhere where I would normally do an array
of char, and pass by ref, how could this happen?

Of course, if you pass large constants by value, you get stack overflows.
But
that is an user error. Same for temps, if I do actions on a too high
level,
I'll need temps.

Admitted, in ansi-iso (or M2 notation, which I'm more used too than
ansi-iso) you have to declare the temps, but the principle remains the
same.

> I disagree that length is needed in most string operations. 
> Compares, writes, and most copies can just start at the beginning
> and go on until the end.  Nul terminated strings do very well for
> this sort of operation.  Concatenation is an exception.

E.g. on a x86 compare is typically done by a rep cmpsb which needs length,
same with copy. C char *'s are slow because, in a comparison case, have to
check each character once for the comparison, once _each_ for zero.

Of course the compiler builders went through a lot of trouble to try to
speed this up, but that is brute force, not elegance.

p.s. I miss ansi-iso strings in the equation. How expensive is a lenght()
on
a 7185 "string" ?
 




 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 Sun Jul 6 1:34:41 CDT 2008.