Re: Get_Line

Martin Persson <[email protected]> Wed, 26 Feb 2003 15:16:04 +0100
Newsgroups gmane.comp.lang.ada.sockets
Message-ID <[email protected]>
Nothing is wrong with it, except that I find it annoying that I must 
have an anonymous inner block to solve the problem.

I think I've gotten an answer to why it is a function; it is a straight 
port of the C-version. But I don't see why a procedure can't be added to 
make the library more comformant with the string IO of standard Ada.

-- Martin

Preben Randhol wrote:
> Martin Persson <[email protected]> wrote on 26/02/2003 (13:00) :
> 
>>Is there a design reason why Get_Line in AdaSockets is a function and 
>>not comformant with the standard Get_Line for strings which is a procedure?
>>
>>One of the problems with a function arises when one stores the result in 
>>a string and wants to find out the real length of the line (without 
>>using Unbounded or similar solutions). This is dealt with in 
>>Ada.Text_IO.Get_Line by returning the string and the real length via out 
>>parameters.
> 
> 
> whats wrong with:
> 
>    declare
>       Result : = Get_Line (Some_Socket);
>    begin
>       Length := Result'Length 
>    end;
> 
> 


_______________________________________________
AdaSockets mailing list
[email protected]
http://www.rfc1149.net/mailman/listinfo/adasockets