comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.de>
Subject: Re: ICFP Programming Contest virtual machine in Ada
Date: Wed, 02 Aug 2006 11:13:47 +0200
Date: 2006-08-02T11:11:56+02:00	[thread overview]
Message-ID: <44d06c5b$0$18518$9b4e6d93@newsread2.arcor-online.net> (raw)
In-Reply-To: <mailman.13.1154474930.32700.comp.lang.ada@ada-france.org>

Javier Miranda wrote:
> 
> On Aug 1, 2006, at 4:43 PM, Georg Bauhaus wrote:
> 
>> Alas, this code cannot be compiled with a plain Ada compiler
>> as it uses non-Ada 'Img (which is brief, though).
> 
> Considering T the type of the object to which you apply this
> attribute, this is a GNAT attribute that is equivalent to
> T'Image (Obj).

Yes, but 'Img was invented for quickly writing debugging
expressions, IIRC, not for writing standard Ada expressions.

It might be worth pointing out that T must be a scalar type.

> For example, being V a variable containing an integer value,
> instead of writing Integer'Image (V) you can just write V'Img.

No, you can't write V'Img because 'Img is a GNAT implementation
defined attribute ;-) For a standard Ada program, you must write
Integer'Image(V).

Pragma Extensions_Allowed(Off) does not seem to turn this 'Img
extension of. Is there a switch to instruct gnatmake to warn
about implementation defined attributes? Or more generally,
something with an intent similar to -gnato, or -gnat83/95/05,
that makes GNAT reject non-standard constructs? 

(I have found some advice in the GNAT documentation
to not use implementation defined pragmas when portability
is an issue; given the qualities of GNAT, I should think that
it can categorize the pragmas found in source text, and inform
about the result.)


-- Georg 






  reply	other threads:[~2006-08-02  9:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-01  9:59 ICFP Programming Contest virtual machine in Ada Samuel Tardieu
2006-08-01 16:14 ` Hyman Rosen
2006-08-01 18:53   ` Samuel Tardieu
2006-08-01 20:33     ` Hyman Rosen
2006-08-01 23:29       ` Samuel Tardieu
2006-08-01 20:43 ` Georg Bauhaus
2006-08-01 21:22   ` Alex Buell
2006-08-01 23:28   ` Javier Miranda
2006-08-02  9:13     ` Georg Bauhaus [this message]
2006-08-02 10:29       ` Javier Miranda
     [not found]       ` <2BEFF609-48F1-4420-8A24-ECFCB5BAD1E3@iuma.ulpgc.es>
2006-08-02 12:39         ` Javier Miranda
2006-08-02 13:57           ` Georg Bauhaus
2006-08-01 23:47   ` Samuel Tardieu
2006-08-02  5:13   ` Gautier
2006-08-02  9:36     ` Samuel Tardieu
2006-08-02 20:39       ` tmoran
2006-08-03  7:30       ` gautier_niouzes
2006-08-03 13:36         ` Samuel Tardieu
2006-08-03 22:58     ` Keith Thompson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox