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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,da46977c58c329df X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-08 16:38:26 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!howland.erols.net!nntp.abs.net!dca6-feed2.news.digex.net!intermedia!newsfeed1.cidera.com!Cidera!cyclone.columbus.rr.com!cyclone3.kc.rr.com!news3.kc.rr.com!typhoon.san.rr.com!not-for-mail Sender: David Brown From: David Brown Subject: Re: Ada's Slide To Oblivion ... Newsgroups: comp.lang.ada References: <4519e058.0201310714.650888e1@posting.google.com> <3C598CAA.7040801@home.com> <3C59FCD3.928144FB@adaworks.com> <7v8za79id0.fsf@vlinux.voxelvision.no> <3C6288CB.3227AF20@cfmu.eurocontrol.be> <3C62D397.8040001@mail.com> <%rC88.3860$oC3.2148048@typhoon.san.rr.com> <3C63AB8A.F52337D8@cfmu.eurocontrol.be> User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (Linux/2.4.16 (i686)) Message-ID: <0d_88.514$4x.457636@typhoon.san.rr.com> Date: Sat, 09 Feb 2002 00:39:24 GMT NNTP-Posting-Host: 24.165.4.233 X-Complaints-To: abuse@rr.com X-Trace: typhoon.san.rr.com 1013215164 24.165.4.233 (Fri, 08 Feb 2002 16:39:24 PST) NNTP-Posting-Date: Fri, 08 Feb 2002 16:39:24 PST Organization: Road Runner Xref: archiver1.google.com comp.lang.ada:19806 Date: 2002-02-09T00:39:24+00:00 List-Id: Ian Wild wrote: > David Brown wrote: >> Legality aside, I have yet to find a compiler that doesn't accept this. > > I'll agree that most compilers will accept it, but it's not > C and quite often doesn't do what you're expecting. The "quite often" part is really going to depend on what you're doing. Most processors that are used for general purposes these days have the same memory spaces for code and data. Every processor that I've seen posted to this list certainly does. A good counter example is the Atmel AVR Risc processor. This is a microcontroller where instructions are fetched from flash memory, and data comes from SRAM. There are separate load instructions to retrieve data from the two types of memory. This is an example where data to function pointer conversions in C aren't going to work. On most architectures, C compilers will implement the pointer conversions in the obvious way. If they didn't, their compilers would probably be unable to compile operating systems and system libraries. BTW, I believe that GNAT assumes the address spaces are the same to construct trampolines for nested procedure pointers. gcc for C also does if you nest functions (a gcc extension). Yes, using this feature is unportable, but hopefully someone constructing opcodes, writing them in memory, and trying to execute them isn't expecting it to be portable. There are a lot of other issues you have to worry about when you do this, such as cache coherency, since many processors have separate I and D caches. David Brown