From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,f92fbb4a0420dd57 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,f92fbb4a0420dd57 X-Google-Attributes: gid103376,public From: kcline@sun132.spd.dsccc.com (Kevin Cline) Subject: Re: some questions re. Ada/GNAT from a C++/GCC user Date: 1996/04/02 Message-ID: <4jrhj0$lqd@tpd.dsccc.com>#1/1 X-Deja-AN: 145438597 references: <4jlj79$h1k@Nntp1.mcs.net> organization: DSC Communications Corporation Switch Products Division newsgroups: comp.lang.ada,comp.lang.c++ Date: 1996-04-02T00:00:00+00:00 List-Id: In article , Robert A Duff wrote: >Well, I'm not sure exactly what you're asking. To print stuff out, you >need some procedure that prints text strings, and you need some way to >convert whatever you want to print out into a text string. In Ada, >'Image is used to convert simple data types like Integer and Float into >human-readable Strings. For complicated data types, you write your own >Image function. This is a flaw in the Ada language design, IMHO. Why should different methods be used to externalize primitive and user-defined types? It certainly makes program maintainence more difficult; imagine a change from type sequence_number_type is 0..2**32-1 to type sequence_number_type is record time: time_type; serial: 2**32-1; end; If this change was not anticipated then every use of 'IMAGE to output a sequence number must be changed to IMAGE(). >The "&" operator just concatenates Strings. So to >print out some stuff, you write: > > Put("X = " & Integer'Image(X) & "; and List = " & Image(List)); > Sloshing all those characters around unnecessarily gets a bit expensive after a while. This expression is likely to copy the list image twice before it is actually output. -- Kevin Cline