comp.lang.ada
 help / color / mirror / Atom feed
* RE: style Q: type .. is new String;
@ 2004-01-09 17:17 amado.alves
  0 siblings, 0 replies; 7+ messages in thread
From: amado.alves @ 2004-01-09 17:17 UTC (permalink / raw)
  To: comp.lang.ada

>>Though I create new types regularly for numeric variables, I've only
>>rarely used other than the standard String type.  That saves doing type
>>conversions, but it would be nice to have strong type checking help me
>>detect errors.  Do other folks use new String types a lot and find it
>>works out well?

>No.  But my reason is different.  I use Bounded_String a lot...

Me too.  And I also use Unbounded_String a lot because it has the wonderful feature of memory magic (no memory associated with a US object is lost upon assignment or scope exit).  (Shameless publicity: I'll expound this memory magic approach to container design in Ada-Europe 2004 in the half day tutorial "No Pointers, Great Programs". See you there ;-)




^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: style Q: type .. is new String;
@ 2004-01-09 18:17 amado.alves
  0 siblings, 0 replies; 7+ messages in thread
From: amado.alves @ 2004-01-09 18:17 UTC (permalink / raw)
  To: comp.lang.ada

>>Me too.  And I also use Unbounded_String a lot because it has the wonderful
>>feature of memory magic (no memory associated with a US object is lost upon
>>assignment or scope exit).  (Shameless publicity: I'll expound this memory
>>magic approach to container design in Ada-Europe 2004 in the half day
>>tutorial "No Pointers, Great Programs". See you there ;-)

>What about performance?  I've always been worried about the time lost
>allocating/deallocating memory all over the place.

You still have that penalty when you do the memory management explicitly. A decently implemented unbounded container, if properly used, will not penalize you significantly more, if at all. Take a look at Charles.Vectors.Unbounded for example.

Now, if your talking hard real time, of course you need containers with absolutely predictable behaviour w.r.t. to the time their operations take. To achieve that you often write your own containers. This often has the unfortunate effect that the container and the application logics get intertwined. So a container library with real time features would be nice. Fortunately Charles-for-ARG (AI-302/2) has some time complexity features that I believe satisfy at least *soft* real time demands.

Every now and then I do experimental measures of direct vs. indirect memory managent (e.g. String vs. Unbounded_String) in real applications, and mostly I find that the time taken by memory allocation/deallocation is not significant. That is not surprising if you think that because memory allocation/deallocation is such a basic thing in the execution of programs the system mechanisms to achieve must be very optimized (and they indeed are if you look at them directly although I haven't done that in a long time).




^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <468D78E4EE5C6A4093A4C00F29DF513D04B82B19@VS2.hdi.tvcabo>]
* style Q: type .. is new String;
@ 2004-01-09  0:00 tmoran
  2004-01-09  2:31 ` Stephen Leake
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: tmoran @ 2004-01-09  0:00 UTC (permalink / raw)


Though I create new types regularly for numeric variables, I've only
rarely used other than the standard String type.  That saves doing type
conversions, but it would be nice to have strong type checking help me
detect errors.  Do other folks use new String types a lot and find it
works out well?



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

end of thread, other threads:[~2004-01-09 18:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-09 17:17 style Q: type .. is new String; amado.alves
  -- strict thread matches above, loose matches on Subject: below --
2004-01-09 18:17 amado.alves
     [not found] <468D78E4EE5C6A4093A4C00F29DF513D04B82B19@VS2.hdi.tvcabo>
2004-01-09 17:34 ` Duncan Sands
2004-01-09  0:00 tmoran
2004-01-09  2:31 ` Stephen Leake
2004-01-09  2:58 ` Robert A Duff
2004-01-09 16:10 ` Robert I. Eachus

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