Re: memory management



Simon Wright <simon@xxxxxxxxxxxx> writes:

> Robert A Duff <bobduff@xxxxxxxxxxxxxxxxxxxx> writes:
>
> > By the way, I believe the fat pointers used by GNAT are an option --
> > there's some way to tell it to use thin pointers for
> > access-to-array. GNAT uses fat pointers (by default) only when the
> > designated type is an array, or when the designated type is unknown
> > to the compiler. Access-to-record, which is far more common, uses
> > thin pointers. I don't know of any Ada implementation besides GNAT
> > that uses fat pointers at all.
>
> I think that it uses fat pointers when the type concerned is
> indefinite.

I don't think so -- I think it's only for indefinite *arrays*
(or unknown types). There's really no advantage in fat pointers
for records, unless tags/discrims are separated out, which GNAT
does not do. (Nor does any other compiler I know of.)

> You can make it use thin pointers by specifying the 'Size of the
> pointer (to be 32) or, I'm pretty sure, by pragma Convention (C); I've
> sent classwide pointers via Xt client_data values using one of these
> techniques.

Yes, I think that's right.

- Bob
.



Relevant Pages

  • Re: API design problem - buffer scatter I/O
    ... (like thin and fat pointers), but that should come at the end. ... FIRST learn about the semantics of access types, ... "Thin pointers grant access to constrained subtypes." ...
    (comp.lang.ada)
  • Re: why the usage of gets() is dangerous.
    ... That's most the point of fat pointers. ... object files with fat-pointer-compiled libraries; ... array, and entirely usable within its scope. ...
    (comp.lang.c)
  • Re: why cant functions return arrays
    ... size the programmer wrote]. ... fact, "impossible", and there are a few compilers that do ... Implementations that provide fat pointers generally run compiled ...
    (comp.lang.c)
  • Re: why the usage of gets() is dangerous.
    ... fat pointers break pointer arithmetic and thus require at ... files with 64-bit libraries, little-endian object files with little- ...
    (comp.lang.c)
  • Re: why the usage of gets() is dangerous.
    ... That's most the point of fat pointers. ... link large memory model object files with large memory model ... The implementation does not have to worry about what happens if you (the programmer) do something the C standard states is undefined, since as you know under those situations anything the implementation does is "correct". ...
    (comp.lang.c)