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.6 required=5.0 tests=BAYES_20,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,85ee038f08622eb8 X-Google-Attributes: gid103376,public From: johnherro@aol.com (John Herro) Subject: Re: Array Literals? Date: 1996/08/14 Message-ID: <4utj7m$21o@newsbf02.news.aol.com>#1/1 X-Deja-AN: 174228652 sender: root@newsbf02.news.aol.com references: <4uquru$jrq@Masala.CC.UH.EDU> organization: America Online, Inc. (1-800-827-6364) newsgroups: comp.lang.ada Date: 1996-08-14T00:00:00+00:00 List-Id: cosc19z5@Bayou.UH.EDU (Spasmo) writes: > What exactly is the difference between using > Int_Array' ( ), and Int_Array ( )? The ' with ( ) indicates *qualification*. That is, you're telling the compiler what the type is, because, perhaps, it's not obvious from the literal or the aggregate. The ( ) without the ' indicates *conversion* from one type to another. For example, suppose your Ada compiler implements type Long_Integer, and you have J : Integer; procedure Display(Item : in Integer); procedure Display(Item : in Long_Integer); Then writing Display(3); is ambiguous, so you would *qualify* the literal and write Display(Long_Integer'(3));. On the other hand, if you want to *convert* J to Long_Integer, you use ( ) without the ' and write, for example, Display(Long_Integer(J)); Sometimes you need to qualify an enumeration literal. This example is from my Ada Tutor program (available for download at the Web and FTP sites below my signature): type Rainbow_Color is (Red, Orange, Yellow, Green, Blue, Indigo, Violet); type Traffic_Light Color is (Red, Amber, Green); procedure Display(Item : in Rainbow_Color); procedure Display(Item : in Traffic_Light_Color); Now the compiler can handle Display(Violet); and Display(Amber);, but requires the qualification in Display(Rainbow_Color'(Red));. I hope this helps. - John Herro Software Innovations Technology http://members.aol.com/AdaTutor ftp://members.aol.com/AdaTutor A doctor, a civil engineer, and a software engineer were arguing about who has the oldest profession. The doctor said, "God made Eve from the rib of Adam, a surgical operation." The civil engineer said, "Before He did that, God made order from chaos and put the planets in motion, a feat of civil engineering." The software engineer replied, "Wait a minute! Where do you think the chaos came from?"