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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,37b5f16b9be86fec X-Google-Attributes: gid103376,public From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: ada -> C translator Date: 1997/04/05 Message-ID: <5i4k9s$qrp@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 230844872 References: <5i243c$i1h@mulga.cs.mu.OZ.AU> <5i2ofl$qn6$1@news.nyu.edu> Organization: Comp Sci, University of Melbourne Newsgroups: comp.lang.ada Date: 1997-04-05T00:00:00+00:00 List-Id: kenner@lab.ultra.nyu.edu (Richard Kenner) writes: >The issue isn't support of non-portable constructs, but representation >of data items. Specifically, discriminated records. You will >probably be forced to generate code that has specific offsets encoded >into it. These offsets will depend on the sizes of primitive >datatypes. > >It just *might* be possible to write all these in terms of type sizes >at the C level and make it portable, but that's *really* hard if >possible at all. Well, it's certainly possible. Whether it is practical or not is another question. One possibility is to use union Word { long l; void *p; }; as essentially your only data type in the generated C code. Then you can use arrays instead of structs and you can calculate offsets portably. Of course, this is not efficient. But you can use conditional compilation... -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.