comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: ada -> C translator
Date: 1997/04/04
Date: 1997-04-04T00:00:00+00:00	[thread overview]
Message-ID: <dewar.860160369@merv> (raw)
In-Reply-To: 5i243c$i1h@mulga.cs.mu.OZ.AU


Fergus said

<<Yep, if you want efficiency, you may need to use machine-dependent
code.  However, you can get this without sacrificing portability
if you keep the less efficient but portable C code as a fallback.>>

No, you missed the point. I am not talking about using non-portable
constructs. The code you generate could be 100% ANSI code, but still
not be portable in the sense of being movable to another target
environment. For example, specific shifts might be generated whose
direction depends on the endianness of the target machine. Such code
could be ported, but would not behave as expected on a target of the
other endianness.

The point here is that if you are generating *really* low level C, it
will start having the same kind of knowledge of the target architecture
as a real object code generator would.

Here's another example. You might decide to model a variant record as
an array of chars in the C code, to avoid the difficulty of having to
give a high level model. But you know the alignment requirements for
such an array of bytes and you put in alignment fill bytes explicitly
into your data structures.

Here's another example, you are generating calls to COBOL for implementing
the IS annex. You know on a specific target what COBOL passes by value
and what it passes by reference, and exactly how it orders its arguments
etc. You generate C code that reflects it. The C code is portable from
the point of view of C semantics, but might well not be able to interface
properly with the COBOL compiler on the new target.

There are many many more such examples

Fergus, what you say is true for general C code that tries to get better
efficiency by using special non-portable constructs, but we are talking
a completely different environment here when we talk about using C as
a kind of low level pseudo machine language for compiler output.






  reply	other threads:[~1997-04-04  0:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-03  0:00 ada -> C translator Gabriel Monaton
1997-04-03  0:00 ` Robert A Duff
1997-04-03  0:00   ` Robert Dewar
1997-04-03  0:00     ` Robert Dewar
1997-04-04  0:00     ` Fergus Henderson
1997-04-04  0:00       ` Robert Dewar [this message]
1997-04-05  0:00         ` Fergus Henderson
1997-04-06  0:00           ` Robert Dewar
1997-04-07  0:00             ` Fergus Henderson
1997-04-07  0:00               ` Robert Dewar
1997-04-08  0:00                 ` Richard A. O'Keefe
1997-04-08  0:00                   ` William Clodius
1997-04-09  0:00                     ` Fergus Henderson
1997-04-08  0:00                   ` Robert Dewar
1997-04-08  0:00                 ` Fergus Henderson
1997-04-08  0:00                   ` Robert Dewar
1997-04-08  0:00                     ` William Clodius
1997-04-09  0:00                     ` Fergus Henderson
1997-04-09  0:00                       ` Robert Dewar
1997-04-09  0:00                         ` Fergus Henderson
1997-04-09  0:00                           ` Robert Dewar
1997-04-10  0:00                             ` Fergus Henderson
1997-04-09  0:00                       ` William Clodius
1997-04-04  0:00       ` Richard Kenner
1997-04-05  0:00         ` Fergus Henderson
1997-04-04  0:00     ` Larry Kilgallen
1997-04-04  0:00       ` Robert Dewar
1997-04-05  0:00         ` Larry Kilgallen
1997-04-06  0:00           ` Robert Dewar
     [not found] ` <lvlo6iwws8.fsf@sulu.fl.ensco.com>
1997-04-17  0:00   ` Lance Kibblewhite
replies disabled

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