comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Problem with Unbounded Strings
Date: Fri, 4 Dec 2015 23:02:30 +0100
Date: 2015-12-04T23:02:30+01:00	[thread overview]
Message-ID: <1oxx3iyyndamb$.o30no3w0t1vu$.dlg@40tude.net> (raw)
In-Reply-To: 274dc49b-b7cd-4eef-b333-34bae665c992@googlegroups.com

On Fri, 4 Dec 2015 13:21:55 -0800 (PST), Laurent wrote:

[...]

Works just fine with GNAT GPL 2015.

Try to print Length (Buffer) as well to see how long the string actually
is. You could have problems with controlling characters.

1. When dealing with character files, it is better to use Stream I/O
instead of Text_IO and recognize line ends manually instead of Get_Line.
The way the protocol defines line termination might be incompatible with
one of Get_Line and/or the OS.

2. Buffer should be an "in out" parameter. It is not a big difference in
this case, but cleaner.

3. You should never use End_Of_File. It might be quite expensive or not
working, e.g. some the protocol may deploy explicit terminators, like EOF.
Exit file read loops with End_Error exception.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  parent reply	other threads:[~2015-12-04 22:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 15:49 Problem with Unbounded Strings Laurent
2015-12-04 16:04 ` Dmitry A. Kazakov
2015-12-04 16:53   ` Laurent
2015-12-04 18:00     ` Niklas Holsti
2015-12-04 21:05       ` Laurent
2015-12-04 20:34     ` Dmitry A. Kazakov
2015-12-04 21:43       ` Laurent
2015-12-04 22:23         ` Dmitry A. Kazakov
2015-12-05 10:22           ` Laurent
2015-12-05 12:19             ` Dmitry A. Kazakov
2015-12-05 13:15               ` Laurent
2015-12-04 18:08 ` Jeffrey R. Carter
2015-12-04 21:21   ` Laurent
2015-12-04 21:59     ` Simon Wright
2015-12-04 23:19       ` Laurent
2015-12-04 22:02     ` Dmitry A. Kazakov [this message]
2015-12-04 22:28     ` Jeffrey R. Carter
2015-12-04 23:35       ` Laurent
2015-12-04 23:59         ` Jeffrey R. Carter
2015-12-05 10:13           ` Laurent
2015-12-08  1:53           ` Randy Brukardt
2015-12-04 23:00     ` Ben Bacarisse
replies disabled

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