comp.lang.ada
 help / color / mirror / Atom feed
From: lutz@iks-jena.de (Lutz Donnerhacke)
Subject: Re: Ada Idioms Progress Preview
Date: Tue, 14 Aug 2001 08:49:41 +0000 (UTC)
Date: 2001-08-14T08:49:41+00:00	[thread overview]
Message-ID: <slrn9nhph4.ht.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: umqr8ug55d9.fsf@maestro.clustra.com

* Ole-Hjalmar Kristensen wrote:
>One thing which can be said in favour of having a terminator character is
>that it frees you from having to store the length explicitly.

This requires an out-of-band terminator, which does not exists in C.
Instead they prefer to use a valid character they do not need at the moment.

But the real problem of a terminator character is creating a view:
In order to reference a substring you have to create a full copy of the
substring because you have to insert the terminal character. Inserting it
directly into the main version would cause serve damage.

Dealing with copies:
  - is time inefficient.
  - is semantical different modulo modifications.
  - is space inefficient.
  - requires heap space instead of stack space.

>The length of a string is usually different from the size of the array
>used to store the string.

It's not necessary to provide a buffer to hold any possible string of a
given type if you can pass complex objects to or from a function. C can only
pass primitive types and therefore switched to passing pointers of implicit
terminated arrays.



  parent reply	other threads:[~2001-08-14  8:49 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-03  4:16 Ada Idioms Progress Preview James Rogers
2001-08-03 19:45 ` Robert Dewar
2001-08-03 22:02   ` James Rogers
2001-08-06 22:33   ` Stanley R. Allen
2001-08-07  2:45     ` tmoran
2001-08-07 12:15       ` Larry Kilgallen
2001-08-07 13:26         ` Philip Anderson
2001-08-08  2:23         ` Robert Dewar
2001-08-08  5:58           ` Ehud Lamm
2001-08-08  2:19       ` Robert Dewar
2001-08-08 15:13         ` Ted Dennison
2001-08-08 18:03           ` tmoran
2001-08-09 20:36           ` Florian Weimer
2001-08-10 21:02         ` Jay Nabonne
2001-08-10 21:51           ` Larry Kilgallen
2001-08-13 14:19             ` Ted Dennison
2001-08-13 14:05           ` Ted Dennison
2001-08-13 14:19             ` Marin David Condic
2001-08-13 15:47             ` Ole-Hjalmar Kristensen
2001-08-13 16:22               ` Marin David Condic
2001-08-13 18:48               ` Larry Kilgallen
2001-08-14  7:05                 ` Ole-Hjalmar Kristensen
2001-08-13 20:20               ` James Rogers
2001-08-14  1:09                 ` Warren W. Gay VE3WWG
2001-08-14  6:15                   ` James Rogers
2001-08-14 14:03                     ` Warren W. Gay VE3WWG
2001-08-21  5:54                   ` C strings, was " David Thompson
2001-08-16 18:42                 ` Jay Nabonne
2001-08-17  1:25                   ` Robert Dewar
2001-08-13 21:47               ` Ted Dennison
2001-08-14  7:37                 ` Ole-Hjalmar Kristensen
2001-08-14 14:59                   ` Ted Dennison
2001-08-14 13:22                 ` Marin David Condic
2001-08-14 15:12                   ` Ted Dennison
2001-08-14 15:33                     ` Marin David Condic
2001-08-14  8:49               ` Lutz Donnerhacke [this message]
2001-08-14  9:38                 ` Ole-Hjalmar Kristensen
2001-08-14  9:54                   ` Lutz Donnerhacke
2001-08-14 14:51                     ` James Rogers
2001-08-14 16:44                   ` Darren New
2001-08-14  1:39             ` Slicing ( Ada Idioms Progress Preview ) Warren W. Gay VE3WWG
replies disabled

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