comp.lang.ada
 help / color / mirror / Atom feed
From: Dale Stanbrough <dale@goanna.cs.rmit.EDU.AU>
Subject: Re: 'first of strings returned from a function should be 1?
Date: 1997/07/27
Date: 1997-07-27T00:00:00+00:00	[thread overview]
Message-ID: <5rg99c$pg1$1@goanna.cs.rmit.edu.au> (raw)
In-Reply-To: EDzr92.M8o@world.std.com


Robert A Duff writes:

"I don't get it.  It sounds like you're willing to painstakingly
 calculate 387 characters, and then throw away all but one of them.  But
 yet you begrudge the copying of them.
 
 What's the real-life example where this makes sense?"

For my current situation it doesn't really matter much (i have written a
function that selects a field from a colon (or whatever) separated list
of fields in a string, and i am currently extracting a single character
string), but the more general question came to mind.

If I selected a field, and wanted to check whether a substring existed...

   if Index (Field (Line, 2, ':'), "xxx") = 0 then

Copying the string (yet again) just to pass it to another function didn't
seem to make sense. Perhaps I could also write Field as a procedure returning 
an upper and lower bound to eliminate all copying.

Good point.

Dale




  reply	other threads:[~1997-07-27  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5rcaqi$le8$1@goanna.cs.rmit.edu.au>
1997-07-26  0:00 ` 'first of strings returned from a function should be 1? Matthew Heaney
1997-07-27  0:00 ` David C. Hoos, Sr.
1997-07-27  0:00   ` Matthew Heaney
1997-07-28  0:00     ` Robert A Duff
1997-07-29  0:00       ` Anonymous
1997-07-30  0:00         ` Robert A Duff
1997-07-30  0:00       ` Dale Stanbrough
1997-07-27  0:00   ` Dale Stanbrough
1997-07-27  0:00     ` Robert A Duff
1997-07-27  0:00       ` Dale Stanbrough [this message]
1997-07-27  0:00         ` Matthew Heaney
1997-07-27  0:00   ` Simon Wright
1997-07-27  0:00 ` Dale Stanbrough
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox