comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nickroberts@callnetuk.com>
Subject: Re: More C
Date: 2000/02/02
Date: 2000-02-02T00:00:00+00:00	[thread overview]
Message-ID: <38982a12@eeyore.callnetuk.com> (raw)
In-Reply-To: vhioga1r2j8.fsf@grotte.ifi.uio.no

Jan's comments broadly accepted.

It surely demonstrates one aspect of the deficiencies of C as a software
engineering language, that the programmer has, in general, no control over
how types are represented, and that it is common for C compilers to vary
from one another (and the ANSI standard) in this matter.

In this respect, it is necessary to think of interfacing Ada source code not
to C source code, but to C object code (i.e. C source as compiled by a
particular version of a particular compiler, with a particular set of flags
in force).

To the rescue, to a certain extent, comes the ability of most C compilers to
output an assembly listing (or other listing) that shows the representations
(and addresses) chosen for types and objects.

--
Nick Roberts
http://www.adapower.com/lab/adaos

"Jan Kroken" <jankr@nntp.ifi.uio.no> wrote in message
news:vhioga1r2j8.fsf@grotte.ifi.uio.no...
> ...
> What if the [C] compiler decides to optimize access to the record,
> so the real memory structure becomes as follows?
>
> for SDL_Color use
>    record
>      Red   at 0  range 0..7;
>      Green at 32 range 32..39;
>      Blue  at 64 range 64..71;
>    end record;
> for SDL_Color'Size use 128;
> ...







  parent reply	other threads:[~2000-02-02  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <vhizotrc4x7.fsf@grotte.ifi.uio.no>
2000-01-28  0:00 ` More C tmoran
2000-01-28  0:00   ` David Starner
2000-01-28  0:00     ` Pascal Obry
2000-01-28  0:00       ` David Starner
2000-01-28  0:00         ` tmoran
2000-01-28  0:00 ` Jeff Carter
2000-01-28  0:00 ` Gautier
2000-01-30  0:00 ` Nick Roberts
     [not found]   ` <vhioga1r2j8.fsf@grotte.ifi.uio.no>
2000-02-01  0:00     ` tmoran
2000-02-02  0:00     ` Nick Roberts [this message]
2000-02-03  0:00     ` 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