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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,dc1fff2721602dfa X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.211.193 with SMTP id gp1mr5372714qab.4.1359679836289; Thu, 31 Jan 2013 16:50:36 -0800 (PST) X-Received: by 10.49.116.1 with SMTP id js1mr1095949qeb.19.1359679836220; Thu, 31 Jan 2013 16:50:36 -0800 (PST) Path: k2ni4456qap.0!nntp.google.com!p13no7590009qai.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 31 Jan 2013 16:50:35 -0800 (PST) In-Reply-To: <4978d638-a04b-4561-85e9-cf6620265af2@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.153.54.159; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.153.54.159 References: <4978d638-a04b-4561-85e9-cf6620265af2@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <32cecb27-4b2f-4892-8b15-b61ed08ae29a@googlegroups.com> Subject: Re: Ada and string literals From: Shark8 Injection-Date: Fri, 01 Feb 2013 00:50:36 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-01-31T16:50:35-08:00 List-Id: On Tuesday, January 29, 2013 6:44:44 PM UTC-6, codeallergy wrote: > hi comp.lang.ada, > > question from a newcomer: Why ada does not allow using a string literal with access type ? > abc : access string := "LITERAL"; -- error. > > example with C: http://ideone.com/Ioapww > > > Thanks > Rom B. Because a String and an Access String are different types. You could fix it by saying: abc : access string := new String'("LITERAL"); or perhaps more safely: def : Aliased String:= "LITERAL"; abc : access string := def'access;