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=-0.5 required=5.0 tests=BAYES_00,INVALID_MSGID, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,336232e570812d9b,start X-Google-Attributes: gid103376,public From: "Bernd Ragutt" Subject: Stream_io / records with default discriminants Date: 1999/02/14 Message-ID: #1/1 X-Deja-AN: 444208309 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Newsgroups: comp.lang.ada Date: 1999-02-14T00:00:00+00:00 List-Id: Hello! I am trying to understand writing to and reading from streams. The Ada95 LRM 13.13.2 (26) states "If T has discriminants without (!) defaults, S�Output ...". I have no problems writing and reading records without (!) default discriminants (using S'Output and S'Input). But when trying to read a record with (!) a default discriminant (using S'Output and S'Input), there is an exception. What's wrong? I do understand the LRM the following way: For every subtype S of a specific type T, that is, for all (!) types, with and without default discriminants, writing and reading with S'Output and S'Input should function. Any comments? Bernd Ragutt from Munich ---------------------- BerndRagutt@csi.com *** *** Ada95 LRM 13.13.2 Stream-Oriented Attributes ... 25 Unless overridden by an attribute_definition_clause, ... [S'Input, S'Output] ... execute as follows: 26 � If T is an array type, S�Output first writes the bounds, and S�Input first reads the bounds. If T has discriminants without defaults, S�Output first writes the discriminants (using S�Write for each), and S�Input first reads the discriminants (using S�Read for each). 27 � S�Output then calls S�Write to write the value of Item to the stream. S�Input then creates an object (with the bounds or discriminants, if any, taken from the stream), initializes it with S�Read, and returns the value of the object. *** ***