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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38159b1b5557a2e7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-24 21:02:20 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!green.octanews.net!news.octanews.net!news-out.visi.com!petbe.visi.com!newshosting.com!news-xfer1.atl.newshosting.com!63.223.6.99.MISMATCH!c03.atl99!sjc70.webusenet.com!news.webusenet.com!pd7cy2so!pd7cy1no!shaw.ca!border1.nntp.ash.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 24 Jan 2004 23:02:17 -0600 Date: Sun, 25 Jan 2004 00:02:16 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Standard Ada Preprocessor References: <401272E3.4040506@noplace.com> <8LzQb.12619$U%5.77885@attbi_s03> <4012D932.9010509@noplace.com> In-Reply-To: <4012D932.9010509@noplace.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.77.160 X-Trace: sv3-a5dpxbNXkrmuuC2POYqw52+Bwj+kawMlO07fXEgKc17o0qdv1xZXTB0o8ZRA0PFiByxGhW1xApfjPQx!EYKTej51c6V6bT7lW5LPCbUXzt3SxAlPrPSjxw9YgFX6mulElppXh36z/6XoUg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:4791 Date: 2004-01-25T00:02:16-05:00 List-Id: Marin David Condic wrote: > A simple case: Suppose you are developing for an embedded box but you > want to do some simple "Smoke Testing" on a PC. For the embedded box, > you need a rep clause for some register. For the PC you're dummying that > up with something and don't want a rep clause at all. (Or the PC > compiler barfs on the rep clause that the embedded compiler accepts.) It > would be nice to say "If compiling for the PC with Aonix, use this code > (no rep), but if compiling for the target with the Gnat compiler, go use > that code..." You are familar with RM 13.1(22) right? "An implementation need not support representation items containing nonstatic expressions, except that an implementation should support a representation item for a given entity if each nonstatic expression in the representation item is a name that statically denotes a constant declared before the entity." I know it is Implemenation Advice, but especially for Address representation specifications it is almost required of any decent compiler that they support at least this. If you don't understand how to read it look at the "Rosen trick": function Random(Gen: Generator) return Float is Local: Generator; for Local'Address use Gen'Address; begin .... end Random; The value of Gen'Address is definitely non-static. But it is easy for a compiler to "get it right" in this case because the value of Local'Address each time the declaration of Local is elaborated. What has this got to do with Marin's complaint? He thinks that invalid representation clauses must be illegal. If they are non-static they can't be illegal because the value to be set at run-time is wrong. Either the compiler will raise Program_Error at run-time or execution of the invalid representation clause will make the program erroneous. See for example RM 13.3(13): "If an Address is specified, it is the programmer's responsibility to ensure that the address is valid; otherwise, program execution is erroneous." Since the address in the representation clause need not be static, your program can set it at run-time depending on the hardware involved. You mean you have never done that? I have code with address clauses that depend on system calls made at run-time. So loosen up a little Marin, and try writing non-static representation clauses. Remember 13.1(22) that I referenced above, and that 'Size for objects (but not subtypes) must be static, RM 13.3(41). But you should be able to do a lot more with Rep clauses than you have done so far. ;-) -- Robert I. Eachus "The war on terror is a different kind of war, waged capture by capture, cell by cell, and victory by victory. Our security is assured by our perseverance and by our sure belief in the success of liberty." -- George W. Bush