comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@earthlink.net>
Subject: Re: Desirability of C++
Date: 2000/05/04
Date: 2000-05-04T00:00:00+00:00	[thread overview]
Message-ID: <391198AB.BB1D1DA1@earthlink.net> (raw)
In-Reply-To: wccaei7lm9z.fsf@world.std.com

Robert A Duff wrote:
  
> I don't see why.  It makes perfect sense to assign a max-5 string into a
> max-10 string, and it can't fail at run time.  I could understand
> wanting to reject assignments from max-10 to max-5, because otherwise
> that might fail at run time.

  Because there is a conversion there, and it is unusual enough that I
don't want it to be an implicit conversion.  I may know that:

  Full_Name := First_Name & ' ' & Middle_Name & ' ' & Last_Name;

  is an assignment that will never fail, but I prefer to write
explicitly:

   Full_Name := To_Bounded_String(First_Name & ' ' &
                            Middle_Name & ' ' & Last_Name);

  what is so difficult about that?  Of course, if you are one of those
poor souls who has to live with restrictions on use clauses, don't blame
me.

    I said:
     
> >                If you really get upset about explicit conversions,
> > then instantiate Bounded_String once, with the maximum of all the
> > maximum sizes.
> 
> Then you waste memory on the strings that could have been small.
> If you think different max sizes are useful at all, then surely
> you will want to make different choices in different cases.

   (Bob's words above seem to imply that I am in favor of something that
I am not, and my words imply that he is in favor of something that he is
not.  I don't think either of us is confused, but that this is a case
where informal English is inherently confusing--all uses of "you" above
are indefinite placeholders, not the second person pronoun.)

   I don't "waste" memory on such things, although I don't really worry
about such a detail as a waste in any case.  There are cases in
databases where fields will be stored uncompressed, but in general
inserting "blank space" in data records will not increase the size of a
file due to compression.    I personally prefer to use different
instances of Bounded_String for different types of data, even when the
max sizes are the same.  I like the diagnostics I get.

> Surely you don't mean "cannot".  If you write 16 instantiations of
> Ada.Strings.Bounded in your program, you will get 16 copies of the code,
> on most compilers.  Perhaps you mean that a clever compiler could share
> the code?

  If the compiler you use does not pay attention to the possibility of
multiple instances of Ada.Strings.Bounded in a program, then yes you
could get code bloat when you compile thirty different packages
containing instances of Ada.Strings.Bounded, whether or not they are the
same size.  But if this is broken in your implementation, then this is a
minor issue compared to multiple instances of the generics in Text_IO.

  However, in reality, no implementation of Ada.Strings.Bounded should
generate ANY code.  There are interfaces which should map to calls to
non-generic library routines, and there are interfaces which are to
routines that should result in little or no code.  So, as far as I am
concerned, every subroutine in Ada.Strings.Bounded should have a pragma
Inline in the private part.
  
> One.  But it's not terribly useful, being inside a recursive function
> where I can't get at it.

     Okay, so you are saying that compiler writers will correctly do
generic instantiation at run-time when they must do it at run-time, but
otherwise they will bloat the code?  If you are using a compiler that is
that brain dead, just put all your instantiations inside the main
program, with parameters that cannot be evaluated until run-time.  But I
find this very hard to believe.  An instantiation of Ada.Strings.Bounded
must create an object, which may be required to be on the stack.  That
object may contain a code pointer, but the code can't go on the stack in
most architectures.  If that is the only possible way to implement some
instantiations, why would a compiler choose to go to a lot of extra
effort to handle some other cases wrong?  (As I said, I can imagine a
compiler that won't recogize the existance of several instantiations of
Ada.Stings.Fixed in different compilations and will create different
code modules, but not recognizing multiple instances in the same
compilation is just dumb.  What does gnat do here?  (Seems to me that
gnat should trivially detect identical generic instances which are
library units, but may not do code sharing for nested instances in
different compilations.)




  reply	other threads:[~2000-05-04  0:00 UTC|newest]

Thread overview: 176+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-04  0:00 where can we get a job with ada HollymaN
2000-02-03  0:00 ` David Kristola
2000-02-04  0:00   ` EKoerber
2000-02-04  0:00     ` Ted Dennison
2000-02-04  0:00       ` Brian Rogoff
2000-02-05  0:00         ` David Kristola
2000-02-06  0:00           ` Simon Brady
2000-02-07  0:00             ` Ted Dennison
2000-02-07  0:00             ` Gareth
2000-02-07  0:00               ` Simon Brady
2000-02-07  0:00               ` Kent Paul Dolan
2000-02-07  0:00                 ` Gareth
2000-02-08  0:00                   ` Kent Paul Dolan
2000-02-11  0:00                 ` where can we ... [off topic] Nick Roberts
2000-02-07  0:00               ` where can we get a job with ada Ted Dennison
2000-02-12  0:00               ` Jeff Carter
2000-02-28  0:00             ` Florian Weimer
2000-02-29  0:00               ` Ted Dennison
2000-03-01  0:00               ` Wes Groleau
2000-03-04  0:00               ` Robert B. Love 
2000-03-05  0:00                 ` Ada on International Space Station (Re: where can we get a job with ada) Vladimir Olensky
2000-03-08  0:00                   ` Robert B. Love 
2000-03-08  0:00                     ` Vladimir Olensky
2000-03-08  0:00                     ` Jean St-Pierre
2000-04-03  0:00                   ` Andrew Thomas Wilson
2000-04-12  0:00                     ` David Hoffman
2000-04-13  0:00                       ` Robert B. Love 
2000-04-14  0:00                         ` Desirability of C++ (was Re: Ada on International Space Station (Re: where can we get a job with ada)) David Kristola
2000-04-14  0:00                           ` Wes Groleau
2000-04-14  0:00                             ` Desirability of C++ Stanley R. Allen
2000-04-14  0:00                               ` Marin D. Condic
2000-04-15  0:00                                 ` Tarjei T. Jensen
2000-04-15  0:00                                   ` Marin D. Condic
2000-04-15  0:00                                     ` Tarjei T. Jensen
2000-04-17  0:00                                   ` Alfred Hilscher
2000-04-17  0:00                                     ` Gautier
2000-04-18  0:00                                       ` Pascal Obry
2000-04-18  0:00                                       ` Tarjei T. Jensen
2000-04-18  0:00                                         ` Gautier
2000-04-28  0:00                                         ` Richard D Riehle
2000-05-02  0:00                                           ` Tarjei T. Jensen
2000-04-23  0:00                                       ` David Kristola
2000-04-18  0:00                                     ` Tarjei T. Jensen
2000-04-17  0:00                                 ` Alfred Hilscher
2000-04-17  0:00                                   ` Marin D. Condic
2000-04-17  0:00                                     ` Gary Scott
2000-04-28  0:00                               ` Richard D Riehle
2000-04-30  0:00                                 ` Robert B. Love 
2000-05-01  0:00                                   ` Richard D Riehle
2000-05-01  0:00                                     ` Tarjei Tj�stheim Jensen
2000-05-01  0:00                                     ` E. Robert Tisdale
2000-04-30  0:00                                       ` Keith Thompson
2000-05-01  0:00                                         ` E. Robert Tisdale
2000-05-01  0:00                                           ` Keith Thompson
2000-05-01  0:00                                       ` Tarjei Tj�stheim Jensen
2000-05-01  0:00                                         ` Pascal Obry
2000-05-01  0:00                                           ` Tarjei Tj�stheim Jensen
2000-05-01  0:00                                           ` Gautier
2000-05-01  0:00                                             ` Ted Dennison
2000-05-01  0:00                                         ` Gautier
2000-05-01  0:00                                       ` Ted Dennison
2000-05-01  0:00                                       ` Gautier
2000-05-01  0:00                                         ` E. Robert Tisdale
2000-05-01  0:00                                           ` Pat Rogers
2000-05-01  0:00                                             ` David Starner
2000-05-01  0:00                                               ` David Starner
2000-05-01  0:00                                               ` Pat Rogers
2000-05-01  0:00                                                 ` Ted Dennison
2000-05-01  0:00                                                   ` E. Robert Tisdale
2000-05-01  0:00                                                     ` Gautier
2000-05-01  0:00                                                     ` Pat Rogers
2000-05-01  0:00                                               ` Florian Weimer
2000-05-01  0:00                                                 ` Ted Dennison
2000-05-01  0:00                                                   ` Tarjei Tj�stheim Jensen
2000-05-01  0:00                                                     ` Ted Dennison
2000-05-02  0:00                                                       ` Florian Weimer
2000-05-02  0:00                                                       ` Preben Randhol
2000-05-02  0:00                                                   ` Application in Ada (was Desirability of C++) Jean-Pierre Rosen
2000-05-02  0:00                                                     ` Ted Dennison
2000-05-02  0:00                                                       ` Jean-Pierre Rosen
2000-05-03  0:00                                                       ` Tarjei Tj�stheim Jensen
2000-05-03  0:00                                                         ` Ted Dennison
2000-05-01  0:00                                                 ` Desirability of C++ Lionel Draghi
2000-05-02  0:00                                                   ` Florian Weimer
2000-05-01  0:00                                                 ` David Starner
2000-05-01  0:00                                                 ` tmoran
2000-05-01  0:00                                             ` E. Robert Tisdale
2000-05-01  0:00                                               ` Pat Rogers
2000-05-01  0:00                                                 ` Michael P. Walsh
2000-05-01  0:00                                                   ` Pat Rogers
2000-05-01  0:00                                                     ` E. Robert Tisdale
2000-05-02  0:00                                                       ` Bill Greene
2000-05-01  0:00                                         ` Marin D. Condic
2000-05-01  0:00                                         ` Hyman Rosen
2000-05-01  0:00                                           ` Tarjei Tj�stheim Jensen
2000-05-01  0:00                                             ` tmoran
2000-05-02  0:00                                               ` Gautier
2000-05-02  0:00                                                 ` Jean-Pierre Rosen
2000-05-02  0:00                                                   ` Gautier
2000-05-02  0:00                                                     ` Jean-Pierre Rosen
2000-05-03  0:00                                                       ` Robert A Duff
2000-05-03  0:00                                                         ` Jean-Pierre Rosen
2000-05-03  0:00                                                       ` Marin D. Condic
2000-05-03  0:00                                                         ` Jean-Pierre Rosen
2000-05-03  0:00                                                           ` Wes Groleau
2000-05-04  0:00                                                         ` Robert I. Eachus
2000-05-05  0:00                                                           ` Marin D. Condic
2000-05-02  0:00                                                     ` Robert A Duff
2000-05-03  0:00                                                       ` Robert I. Eachus
2000-05-03  0:00                                                         ` Robert A Duff
2000-05-04  0:00                                                           ` Robert I. Eachus [this message]
2000-05-03  0:00                                                       ` Tarjei T. Jensen
2000-05-03  0:00                                                         ` Pascal Obry
2000-05-03  0:00                                                           ` Paul Graham
2000-05-03  0:00                                                             ` Pascal Obry
2000-05-03  0:00                                                               ` Paul Graham
2000-05-03  0:00                                                                 ` Robert A Duff
2000-05-04  0:00                                                               ` Ole-Hjalmar Kristensen
2000-05-04  0:00                                                                 ` Preben Randhol
2000-05-04  0:00                                                                   ` Ole-Hjalmar Kristensen
2000-05-04  0:00                                                                     ` Preben Randhol
2000-05-04  0:00                                                                 ` Pascal Obry
2000-05-05  0:00                                                             ` Gautier
2000-05-04  0:00                                                           ` Ole-Hjalmar Kristensen
2000-05-03  0:00                                                         ` Robert A Duff
2000-05-03  0:00                                                           ` Delphi Strings (was Re: Desirability of C++) Ray Blaak
2000-05-02  0:00                                               ` Desirability of C++ Tarjei T. Jensen
2000-05-02  0:00                                                 ` Preben Randhol
2000-05-02  0:00                                                   ` Strings TP/Ada (was Desirability of C++) Gautier
2000-05-02  0:00                                                   ` Desirability of C++ Keith Thompson
2000-05-03  0:00                                                   ` Tarjei T. Jensen
2000-05-03  0:00                                                     ` Robert A Duff
2000-05-02  0:00                                               ` Al Christians
2000-05-02  0:00                                             ` Gautier
2000-05-01  0:00                                           ` Gautier
2000-05-01  0:00                                             ` Brian Rogoff
2000-05-02  0:00                                               ` Gautier
2000-05-02  0:00                                             ` Ole-Hjalmar Kristensen
2000-05-02  0:00                                           ` Richard D Riehle
2000-05-07  0:00                                       ` ANTHONY GAIR
2000-05-07  0:00                                         ` Richard D Riehle
2000-05-07  0:00                                           ` ANTHONY GAIR
2000-05-08  0:00                                             ` Pascal Obry
2000-05-08  0:00                                               ` Ehud Lamm
2000-05-08  0:00                                                 ` Larry Kilgallen
2000-05-08  0:00                                           ` Mario Klebsch
2000-05-08  0:00                                             ` E. Robert Tisdale
2000-05-08  0:00                                               ` Gautier
2000-05-09  0:00                                               ` Stanley R. Allen
2000-05-10  0:00                                                 ` Alfred Hilscher
2000-05-10  0:00                                                 ` Mario Klebsch
2000-05-08  0:00                                           ` Stanley R. Allen
2000-05-09  0:00                                             ` Richard D Riehle
2000-05-07  0:00                                         ` Robert Dewar
2000-05-07  0:00                                         ` Hyman Rosen
2000-05-07  0:00                                           ` ANTHONY GAIR
2000-05-08  0:00                                             ` Hyman Rosen
2000-05-09  0:00                                               ` Pascal Obry
2000-05-11  0:00                                             ` wv12
2000-05-11  0:00                                               ` Frank J. Lhota
2000-05-11  0:00                                               ` Warner Bruns
2000-05-18  0:00                                                 ` Warner Bruns
2000-05-19  0:00                                                   ` ANTHONY GAIR
2000-05-24  0:00                                                   ` Richard Kenner
2000-05-18  0:00                                                 ` ANTHONY GAIR
2000-05-01  0:00                                 ` Ken Garlington
2000-04-29  0:00                         ` Ada on International Space Station (Re: where can we get a job with ada) Chris Johnston
2000-05-01  0:00                           ` Ted Dennison
     [not found]                       ` <7EA1B852F5D4D8C6.26EEE9181C8Reply-To: Kilgallen@eisner.decus.org.nospam <Ij4OaidfGTH8@eisner.decus.org>
2000-05-01  0:00                         ` Desirability of C++ E. Robert Tisdale
2000-05-01  0:00                       ` Larry Kilgallen
2000-03-05  0:00                 ` where can we get a job with ada Ted Dennison
2000-03-22  0:00                 ` Florian Weimer
2000-03-05  0:00               ` David Kristola
2000-02-04  0:00 ` Stanley R. Allen
2000-02-04  0:00   ` Stanley R. Allen
2000-02-06  0:00 ` David Tannen
replies disabled

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