comp.lang.ada
 help / color / mirror / Atom feed
* Strings dynamic
@ 2001-04-11 18:32 g990406
  2001-04-11 20:17 ` chris.danx
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: g990406 @ 2001-04-11 18:32 UTC (permalink / raw)


Hello,
i have a question for all the group...i am a new ada programmer....
i came from c and i want to know how to make strings dynamic, with length 
diffrentes... Thank you very much

Answers please to: rrilNOSPAMpm@arrakis.es

i am a student of computer sciencie




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Strings dynamic
  2001-04-11 18:32 Strings dynamic g990406
@ 2001-04-11 20:17 ` chris.danx
  2001-04-11 21:00 ` Des Walker
  2001-04-11 22:29 ` James Rogers
  2 siblings, 0 replies; 6+ messages in thread
From: chris.danx @ 2001-04-11 20:17 UTC (permalink / raw)


Look in Ada Reference Manual for Ada.Strings.Unbounded



<g990406@zipi.fi.upm.es> wrote in message
news:PPGTqiNch2sc@zipi.fi.upm.es...
> Hello,
> i have a question for all the group...i am a new ada programmer....
> i came from c and i want to know how to make strings dynamic, with length
> diffrentes... Thank you very much
>






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Strings dynamic
  2001-04-11 18:32 Strings dynamic g990406
  2001-04-11 20:17 ` chris.danx
@ 2001-04-11 21:00 ` Des Walker
  2001-04-11 22:29 ` James Rogers
  2 siblings, 0 replies; 6+ messages in thread
From: Des Walker @ 2001-04-11 21:00 UTC (permalink / raw)



<g990406@zipi.fi.upm.es> wrote in message
news:PPGTqiNch2sc@zipi.fi.upm.es...
> Hello,
> i have a question for all the group...i am a new ada programmer....
> i came from c and i want to know how to make strings dynamic, with
length
> diffrentes... Thank you very much
>
> Answers please to: rrilNOSPAMpm@arrakis.es
>
> i am a student of computer sciencie
>

A good place to start would be with Unbounded_Strings. As the name
suggests they do not have a prespecified length but can change length to
accomodate what you store in them.

You should familiarise yourself with the facilities of the
Ada.Strings.Unbounded package (you should have one in your standard set
of packages). This package should provide all the facilities you need to
manipulate Unbounded_Strings so you have to try decoding their structure
by yourself. One nice advantage. particularly for a beginner, is that
the unbounded string takes care of its own memory management, so you
don't have to worry about things like storage leaks.

A good place to familiarise yourself with the basics of unbounded
strings is the Lovelace tutorial. You can access it on the web:
goto http://www.adahome.com
scroll to the bottome of the page, and from the Floors block select
Lovelace Tutorial (on the right hand side).
From the Lovelace opening page select "The master outline of all the
lessons", and you find the discussion of strings in Lesson 8, with an
example program using Unbounded Strings (at the end of the lesson).

HTH
    Des Walker





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Strings dynamic
  2001-04-11 18:32 Strings dynamic g990406
  2001-04-11 20:17 ` chris.danx
  2001-04-11 21:00 ` Des Walker
@ 2001-04-11 22:29 ` James Rogers
  2001-04-12 15:03   ` Marin David Condic
       [not found]   ` <wTjB6.4345$FY5.306564@www.newsranger.com>
  2 siblings, 2 replies; 6+ messages in thread
From: James Rogers @ 2001-04-11 22:29 UTC (permalink / raw)


g990406@zipi.fi.upm.es wrote:
> 
> Hello,
> i have a question for all the group...i am a new ada programmer....
> i came from c and i want to know how to make strings dynamic, with length
> diffrentes... Thank you very much
> 
> Answers please to: rrilNOSPAMpm@arrakis.es
> 
> i am a student of computer sciencie

If you want a string to behave like a C string, use Ada.Strings.Bounded
package. This will allow you to define a maximum length for your
strings, then use that bounded string object to contain a string of
any length up to the maximum you specified.

If you want completely dynamic string handling, then use the
Ada.Strings.Unbounded package. This package give best flexibility,
but poorest performance due to dynamic memory allocation and
deallocation.

Jim Rogers
Colorado Springs, Colorado USA



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Strings dynamic
  2001-04-11 22:29 ` James Rogers
@ 2001-04-12 15:03   ` Marin David Condic
       [not found]   ` <wTjB6.4345$FY5.306564@www.newsranger.com>
  1 sibling, 0 replies; 6+ messages in thread
From: Marin David Condic @ 2001-04-12 15:03 UTC (permalink / raw)


While in a relative sense, unbounded strings are going to cost you some
performance versus fixed length strings, it has been my experinece that on
most of today's hardware and for most applications, it really doesn't
matter. Unless you're doing some really intense string processing or you've
got some really tough realtime requirements, you won't notice any
performance difference. It would be a mistake to avoid using unbounded
strings out of fear that it will make one's application run too slow. Go for
the ease of use because the performance hit will not be perceptable in most
situations.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"James Rogers" <jimmaureenrogers@worldnet.att.net> wrote in message
news:3AD4DB63.4136CD0A@worldnet.att.net...
> g990406@zipi.fi.upm.es wrote:
> If you want completely dynamic string handling, then use the
> Ada.Strings.Unbounded package. This package give best flexibility,
> but poorest performance due to dynamic memory allocation and
> deallocation.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Strings dynamic
       [not found]   ` <wTjB6.4345$FY5.306564@www.newsranger.com>
@ 2001-04-20 11:52     ` Georg Bauhaus
  0 siblings, 0 replies; 6+ messages in thread
From: Georg Bauhaus @ 2001-04-20 11:52 UTC (permalink / raw)


Ted Dennison (dennison@telepath.com) wrote:
: >> i have a question for all the group...i am a new ada programmer....
: >> i came from c and i want to know how to make strings dynamic, with length
: >> diffrentes... Thank you very much

Just in case you want different length constant strings,
you will find many examples in the archives of comp.lang.ada,
plus in several good old Ada text books.

: Of course one of the things one should learn about Ada is that most of the time
: strings *don't* need to be dynamic, they just need to be sized to match their
: contents. That's different, and usually doesn't require a package to accomplish.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-04-20 11:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-11 18:32 Strings dynamic g990406
2001-04-11 20:17 ` chris.danx
2001-04-11 21:00 ` Des Walker
2001-04-11 22:29 ` James Rogers
2001-04-12 15:03   ` Marin David Condic
     [not found]   ` <wTjB6.4345$FY5.306564@www.newsranger.com>
2001-04-20 11:52     ` Georg Bauhaus

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