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.180.24.228 with SMTP id x4mr1402202wif.4.1359547242484; Wed, 30 Jan 2013 04:00:42 -0800 (PST) Path: i11ni27804wiw.0!nntp.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Mart van de Wege Newsgroups: comp.lang.ada Subject: Re: Ada and string literals Date: Wed, 30 Jan 2013 12:50:38 +0100 Message-ID: <86boc63n5d.fsf@gaheris.avalon.lan> References: <4978d638-a04b-4561-85e9-cf6620265af2@googlegroups.com> Mime-Version: 1.0 X-Trace: individual.net /1nv7tqOCIq8Yhzs9BTZdwIWcHhbTXX3Oul4bKyzXuBfxKTq9C6TB2nQRAkcZU8hkt X-Orig-Path: gaheris.avalon.lan!not-for-mail Cancel-Lock: sha1:/HEE2uwLr4tCrhY4uJdH1gFREEk= sha1:ClxhXsTVKQIfMVBLyBwEyu0ofyo= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) Content-Type: text/plain Date: 2013-01-30T12:50:38+01:00 List-Id: Niklas Holsti writes: > On 13-01-30 02:44 , 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. > > Because, unlike C, Ada does not confuse arrays with pointers. > > This is the closest Ada equivalent: > > Literal : aliased constant String := "LITERAL"; > abc : access constant String := Literal'Access; More importantly, I cannot see why you would want an access to a string literal. Just use the string literal as a normal parameter, and let the compiler worry about how to handle that. Mart -- "We will need a longer wall when the revolution comes." --- AJS, quoting an uncertain source.