comp.lang.ada
 help / color / mirror / Atom feed
* Conversion of Access Types Question
@ 1999-01-14  0:00 Paul S. Heidmann
  1999-01-14  0:00 ` David C. Hoos, Sr.
  0 siblings, 1 reply; 14+ messages in thread
From: Paul S. Heidmann @ 1999-01-14  0:00 UTC (permalink / raw)


Greetings fellow Ada lovers!

I'm an experienced Ada83 programmer that is learning to use Ada95.
Things are going very well, but I don't understand the problems
that I'm having converting access types that point to variables of
class wide types.  Consider the following piece of code:

=======================================

procedure Types is

   type T1 is tagged
      record
         I : Integer;
      end record;
   type A_T1 is access all T1'Class;

   type T2 is new T1 with
      record
         I2 : Integer;
      end record;
   type A_T2_Classwide is access all T2'Class;
   type A_T2 is access T2;

   Thing1 : A_T1;
   Thing2 : A_T2_Classwide;
   Thing3 : A_T2;

begin
   Thing1 := new T2;
   Thing2 := A_T2_Classwide (Thing1);
   Thing3 := A_T2 (Thing1);  -- illegal, types are not convertable.
end Types;

=======================================

My question is, why is the last line an illegal conversion, but the
second to last line not?

Thanks!

Paul Heidmann




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-14  0:00 Conversion of Access Types Question Paul S. Heidmann
@ 1999-01-14  0:00 ` David C. Hoos, Sr.
  1999-01-14  0:00   ` Paul S. Heidmann
  1999-01-15  0:00   ` dewar
  0 siblings, 2 replies; 14+ messages in thread
From: David C. Hoos, Sr. @ 1999-01-14  0:00 UTC (permalink / raw)



Paul S. Heidmann wrote in message <369DFFFC.A160D47C@neta.com>...
>Greetings fellow Ada lovers!
>
>I'm an experienced Ada83 programmer that is learning to use Ada95.
>Things are going very well, but I don't understand the problems
>that I'm having converting access types that point to variables of
>class wide types.  Consider the following piece of code:
>
>=======================================
>
>procedure Types is
>
>   type T1 is tagged
>      record
>         I : Integer;
>      end record;
>   type A_T1 is access all T1'Class;
>
>   type T2 is new T1 with
>      record
>         I2 : Integer;
>      end record;
>   type A_T2_Classwide is access all T2'Class;
>   type A_T2 is access T2;
>
>   Thing1 : A_T1;
>   Thing2 : A_T2_Classwide;
>   Thing3 : A_T2;
>
>begin
>   Thing1 := new T2;
>   Thing2 := A_T2_Classwide (Thing1);
>   Thing3 := A_T2 (Thing1);  -- illegal, types are not convertable.
>end Types;
>
>=======================================
>
>My question is, why is the last line an illegal conversion, but the
>second to last line not?
>
Compiling your code with gnat results in the following message:

  [hoosd@VISNT021 d:/gnat_examples]$ gcc -c types.adb
  types.adb:23:14: target type must be general access type
  types.adb:23:14: add "all" to type "A_T2" defined at line 14

Making the change the compiler directs solves the problem.

i.e., change line 14 to read:
   type A_T2 is access all T2;









^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-14  0:00 ` David C. Hoos, Sr.
@ 1999-01-14  0:00   ` Paul S. Heidmann
  1999-01-14  0:00     ` David C. Hoos, Sr.
  1999-01-14  0:00     ` Tucker Taft
  1999-01-15  0:00   ` dewar
  1 sibling, 2 replies; 14+ messages in thread
From: Paul S. Heidmann @ 1999-01-14  0:00 UTC (permalink / raw)
  To: David C. Hoos, Sr.

David C. Hoos, Sr. wrote:
> 
> Paul S. Heidmann wrote in message <369DFFFC.A160D47C@neta.com>...
> >Greetings fellow Ada lovers!
> >
> >I'm an experienced Ada83 programmer that is learning to use Ada95.
> >Things are going very well, but I don't understand the problems
> >that I'm having converting access types that point to variables of
> >class wide types.  Consider the following piece of code:
> >
> >=======================================
> >
> >procedure Types is
> >
> >   type T1 is tagged
> >      record
> >         I : Integer;
> >      end record;
> >   type A_T1 is access all T1'Class;
> >
> >   type T2 is new T1 with
> >      record
> >         I2 : Integer;
> >      end record;
> >   type A_T2_Classwide is access all T2'Class;
> >   type A_T2 is access T2;
> >
> >   Thing1 : A_T1;
> >   Thing2 : A_T2_Classwide;
> >   Thing3 : A_T2;
> >
> >begin
> >   Thing1 := new T2;
> >   Thing2 := A_T2_Classwide (Thing1);
> >   Thing3 := A_T2 (Thing1);  -- illegal, types are not convertable.
> >end Types;
> >
> >=======================================
> >
> >My question is, why is the last line an illegal conversion, but the
> >second to last line not?
> >
> Compiling your code with gnat results in the following message:
> 
>   [hoosd@VISNT021 d:/gnat_examples]$ gcc -c types.adb
>   types.adb:23:14: target type must be general access type
>   types.adb:23:14: add "all" to type "A_T2" defined at line 14
> 
> Making the change the compiler directs solves the problem.
> 
> i.e., change line 14 to read:
>    type A_T2 is access all T2;

I already understood that could solve the problem by making A_T2
a generalized access type (that's why I have type A_T2_Classwide,
above).  I question is why is this the case?  I could have been
clearer...  Let me give it another try.

A_T2_Classwide is an access type to a group of types rooted at
T2.  In my understanding, the 'class, when applied to T2, refers
to a set of types rooted at T2.  T1, in the above code, would not be
in T2'class, right?  T2 would be in T1'class, however.  Therefore,
A_T1 could point to an object of type T1 or of type T2 (and can, see
first line of code).  If Thing1, above, points to an object of type
T2 (and it does), then I should be able to covert it to A_T2 (but I
can't).  Why is it that adding a 'class, which only refers to things
derived from T2, makes the conversion from A_T1 (which has nothing to
do with T2'Class) legal?

Thanks!

Paul Heidmann




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-14  0:00   ` Paul S. Heidmann
@ 1999-01-14  0:00     ` David C. Hoos, Sr.
  1999-01-14  0:00     ` Tucker Taft
  1 sibling, 0 replies; 14+ messages in thread
From: David C. Hoos, Sr. @ 1999-01-14  0:00 UTC (permalink / raw)



Paul S. Heidmann wrote in message <369E4ACA.B8B07871@neta.com>...
>David C. Hoos, Sr. wrote:
>>
>> Paul S. Heidmann wrote in message <369DFFFC.A160D47C@neta.com>...
>> >Greetings fellow Ada lovers!
>> >
>> >I'm an experienced Ada83 programmer that is learning to use Ada95.
>> >Things are going very well, but I don't understand the problems
>> >that I'm having converting access types that point to variables of
>> >class wide types.  Consider the following piece of code:
>> >
>> >=======================================
>> >
>> >procedure Types is
>> >
>> >   type T1 is tagged
>> >      record
>> >         I : Integer;
>> >      end record;
>> >   type A_T1 is access all T1'Class;
>> >
>> >   type T2 is new T1 with
>> >      record
>> >         I2 : Integer;
>> >      end record;
>> >   type A_T2_Classwide is access all T2'Class;
>> >   type A_T2 is access T2;
>> >
>> >   Thing1 : A_T1;
>> >   Thing2 : A_T2_Classwide;
>> >   Thing3 : A_T2;
>> >
>> >begin
>> >   Thing1 := new T2;
>> >   Thing2 := A_T2_Classwide (Thing1);
>> >   Thing3 := A_T2 (Thing1);  -- illegal, types are not convertable.
>> >end Types;
>> >
>> >=======================================
>> >
>> >My question is, why is the last line an illegal conversion, but the
>> >second to last line not?
>> >
>> Compiling your code with gnat results in the following message:
>>
>>   [hoosd@VISNT021 d:/gnat_examples]$ gcc -c types.adb
>>   types.adb:23:14: target type must be general access type
>>   types.adb:23:14: add "all" to type "A_T2" defined at line 14
>>
>> Making the change the compiler directs solves the problem.
>>
>> i.e., change line 14 to read:
>>    type A_T2 is access all T2;
>
>I already understood that could solve the problem by making A_T2
>a generalized access type (that's why I have type A_T2_Classwide,
>above).  I question is why is this the case?  I could have been
>clearer...  Let me give it another try.
>
>A_T2_Classwide is an access type to a group of types rooted at
>T2.  In my understanding, the 'class, when applied to T2, refers
>to a set of types rooted at T2.  T1, in the above code, would not be
>in T2'class, right?  T2 would be in T1'class, however.  Therefore,
>A_T1 could point to an object of type T1 or of type T2 (and can, see
>first line of code).  If Thing1, above, points to an object of type
>T2 (and it does), then I should be able to covert it to A_T2 (but I
>can't).  Why is it that adding a 'class, which only refers to things
>derived from T2, makes the conversion from A_T1 (which has nothing to
>do with T2'Class) legal?
>
It's not the 'class which made the conversion from A_T1 to A_T2_Classwide
legal, it's the "all" in the declaration of A_T2_Classwide which makes it
legal.


Without the "all" (i.e. the target type is not a general access type), then
the rule of LRM 4.6(21) comes into play:
   Specifically, there is no type which is an ancestor of both the target
type (A_T1), and of the operand type (A_T2).

Making the target type a general access type brings into play the
less-restrictive rules of 4.6(13-17).

Hope this helps.

David C. Hoos, Sr.







^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-14  0:00   ` Paul S. Heidmann
  1999-01-14  0:00     ` David C. Hoos, Sr.
@ 1999-01-14  0:00     ` Tucker Taft
  1 sibling, 0 replies; 14+ messages in thread
From: Tucker Taft @ 1999-01-14  0:00 UTC (permalink / raw)


Paul S. Heidmann (psh@neta.com) wrote:
: David C. Hoos, Sr. wrote:
: > 
: > Paul S. Heidmann wrote in message <369DFFFC.A160D47C@neta.com>...
: > >Greetings fellow Ada lovers!
: > >
: > >I'm an experienced Ada83 programmer that is learning to use Ada95.
: > >Things are going very well, but I don't understand the problems
: > >that I'm having converting access types that point to variables of
: > >class wide types.  Consider the following piece of code:
: > >
: > >=======================================
: > >
: > >procedure Types is
: > >
: > >   type T1 is tagged
: > >      record
: > >         I : Integer;
: > >      end record;
: > >   type A_T1 is access all T1'Class;
: > >
: > >   type T2 is new T1 with
: > >      record
: > >         I2 : Integer;
: > >      end record;
: > >   type A_T2_Classwide is access all T2'Class;
: > >   type A_T2 is access T2;
: > >
: > >   Thing1 : A_T1;
: > >   Thing2 : A_T2_Classwide;
: > >   Thing3 : A_T2;
: > >
: > >begin
: > >   Thing1 := new T2;
: > >   Thing2 := A_T2_Classwide (Thing1);
: > >   Thing3 := A_T2 (Thing1);  -- illegal, types are not convertable.
: > >end Types;
: > >
: > >=======================================
: > >
: > >My question is, why is the last line an illegal conversion, but the
: > >second to last line not?

There are number of rules relating to access type conversion:

  1) If you omit the "all" or the "constant" in the access type definition,
     then you can only convert *to* such an access type from
     another access type with a common ancestor, meaning that
     you have declared one or more access types derived from the
     same access type.  This circumstance comes up very rarely.  

     Hence, the simpler rule-of-thumb is that if you want to 
     convert *to* a particular access type, it must be declared
     with an "all" or "constant" modifier.  You can convert *from*
     an access type without the "all" or "constant" modifier.
     The reason for this is that pool-specific access types (those
     without the "all"/"constant") can have an optimized representation
     (such as an index or offset), allowing them to only point into a 
     single access type storage "pool."

     By constrast, "general" access types have a representation which
     allows them to point into any storage-pool, meaning that their
     representation is generally a full machine address.

  2) Presuming the target access type has an "all" or "constant,"
     then the designated type of the target must be the same,
     or be a tagged type and the target designated type must be
     an ancestor of the source designated type, or be "covered" by
     the source designated type (implying the source designated type
     must be class-wide).  This later case requires an additional
     run-time check.
     
  3) You can't convert an access-to-constant value to an access-to-variable
     type (none of that "casting away const'ness" allowed in Ada).

: ...

: I already understood that could solve the problem by making A_T2
: a generalized access type (that's why I have type A_T2_Classwide,
: above).  I question is why is this the case?  I could have been
: clearer...  Let me give it another try.

The rule-of-thumb given above is that you must specify "all" on the 
target type of an access-type conversion.  I.e it must be a "general"
access type.

: A_T2_Classwide is an access type to a group of types rooted at
: T2.  In my understanding, the 'class, when applied to T2, refers
: to a set of types rooted at T2.  T1, in the above code, would not be
: in T2'class, right?  T2 would be in T1'class, however.  Therefore,
: A_T1 could point to an object of type T1 or of type T2 (and can, see
: first line of code).  If Thing1, above, points to an object of type
: T2 (and it does), then I should be able to covert it to A_T2 (but I
: can't).  Why is it that adding a 'class, which only refers to things
: derived from T2, makes the conversion from A_T1 (which has nothing to
: do with T2'Class) legal?

I think you are still getting confused.  Conversion requires the
target access type to be a general access type.  This is the first 
requirement.  Then there are additional requirements about the 
designated types, as summarized above.

: Thanks!

: Paul Heidmann

--
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-14  0:00 ` David C. Hoos, Sr.
  1999-01-14  0:00   ` Paul S. Heidmann
@ 1999-01-15  0:00   ` dewar
  1999-01-20  0:00     ` Robert A Duff
  1 sibling, 1 reply; 14+ messages in thread
From: dewar @ 1999-01-15  0:00 UTC (permalink / raw)


In article <77l492$b5s@hobbes.crc.com>,
  "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> wrote:

> Compiling your code with gnat results in the following
> message:
>
>  t.adb:23:14: target type must be general access type
>  t.adb:23:14: add "all" to type "A_T2" defined at line 14
>
> Making the change the compiler directs solves the>
> problem.
>
>   i.e., change line 14 to read:
>     type A_T2 is access all T2;

This is a very common misunderstanding in Ada 95, which is
why we recently added the second message, since it is
almost certain to be the right fix. Some Ada 95 programmers
simply make a rule of using "ALL" for all access types.
On almost all compilers, this will have no effect on
generated code, it will just change illegal programs into
(sensible) legal ones.

By the way, we are always striving to make the error
messages in GNAT more helpful. If you find a case where
you feel the error messages could be more helpful, by
all means send mail to report@gnat.com. We have made many
improvements based on such suggestions, and indeed many of
the useful suggestions come from students using the public
version, since they know best what is confusing.

Expert users tend to be less likely to send in such
messages because (a) they know what the error is anyway and
(b) they have very low expectations for good error messages
as a result of using other compilers, particularly for
example, typical C compilers :-)

Robert Dewar
Ada Core Technologies

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-20  0:00     ` Robert A Duff
@ 1999-01-20  0:00       ` Matthew Heaney
  1999-01-20  0:00         ` Tucker Taft
                           ` (2 more replies)
  1999-01-21  0:00       ` robert_dewar
  1 sibling, 3 replies; 14+ messages in thread
From: Matthew Heaney @ 1999-01-20  0:00 UTC (permalink / raw)


Robert A Duff <bobduff@world.std.com> writes:

> dewar@gnat.com writes:
> 
> > This is a very common misunderstanding in Ada 95, which is
> > why we recently added the second message, since it is
> > almost certain to be the right fix. Some Ada 95 programmers
> > simply make a rule of using "ALL" for all access types.
> 
> In retrospect, I think the distinction between the two kinds of access
> types (with and without "all") is not useful enough to have in the
> language.  It's a little bit useful, but as you can see, it causes
> confusion.  It would have been better to simply make all access types
> behave like the "all" kind, and get rid of the "all" syntax.
> 
> That's what Tucker wanted to do in the first place, by the way.
> He was convinced otherwise, partly by me.  :-(


That's what you said back on 1996/05/24 too:

(start of old post)

Re: Type conversion between access types (was: Free'ing extended types)

In article <leschkes.832959439@ferret>,
Scott Leschke <leschkes@ferret.cig.mot.com> wrote:

>I have noticed that in most of the code I've seen, all is used pretty
>liberally would makes me wonder about the benefit of making the
>distinction between pool and general accesss types myself.  I have
>wondered if it may have been better to have the distinction go the
>other way if indeed a distinction was warranted (ie. general and
>non-pool based).

I admit, with 20-20 hindsight, that the 'all' thing was a mistake.  I
pushed for the idea during the design of Ada 9X, because I thought this
efficiency distinction was important.  Tucker, on the other hand,
thought that all access types should be 'all'.  He was right; I was
wrong.

(end of old post)


I completely agree; I just use general access types everywhere.  It's
been my experience that in practice, when writing abstractions that have
flexible memory management schemes, you end up having to declare all the
access types to be general access types anyway.  So why make the
distinction?

And think about the inconsistency with access parameters: you don't make
the distinction there.  Worse, there is no "access constant" parameter,
which we really do need.  (Now, without access constant parameters, we
have to resort to back-door hacks using an in param instead, thus losing
the scope-checks that the compiler would otherwise provide.)

And for what benefit was the distinction between general and
pool-specific access types made?  I think, to be able to have a
different representation for pool-specific types.  But, are there any
compilers that actually do have a different representation?  Couldn't
there have been another way to enable this alternate representation,
such as a pragma?

Adding "access all T" to the language complicates the language, adds
syntactic overhead, and makes this aspect of the language much harder to
learn and teach.

Matt





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-20  0:00       ` Matthew Heaney
@ 1999-01-20  0:00         ` Tucker Taft
  1999-01-21  0:00         ` robert_dewar
  1999-01-27  0:00         ` Nick Roberts
  2 siblings, 0 replies; 14+ messages in thread
From: Tucker Taft @ 1999-01-20  0:00 UTC (permalink / raw)


Matthew Heaney (matthew_heaney@acm.org) wrote:

: ...
: And for what benefit was the distinction between general and
: pool-specific access types made?   ...

For what (little ;-) it's worth, the optimizer can do a better
job if you stick with pool-specific access types, because
fewer things are "killed" when you store through a pool-specific
access value.

As far as history, I certainly wouldn't "blame" Bob for this one.
There was an almost fanatic attention to upward compatibility
during the Ada 9X process, and that attention certainly paid
off in compatibility.  The downside is that there are some things
that look "silly" in retrospect, and this is probably one of them.

Luckily, there aren't many such places, so if you asked someone to draw
a line between Ada 95-only features and Ada 83 features, someone
with no experience in Ada 83 would have trouble doing so.  Even
some of us who used Ada 83 extensively now make the mistake of thinking
a given feature was "always" there (like 'Image on real types, or
child packages).

: Matt

--
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-15  0:00   ` dewar
@ 1999-01-20  0:00     ` Robert A Duff
  1999-01-20  0:00       ` Matthew Heaney
  1999-01-21  0:00       ` robert_dewar
  0 siblings, 2 replies; 14+ messages in thread
From: Robert A Duff @ 1999-01-20  0:00 UTC (permalink / raw)


dewar@gnat.com writes:

> This is a very common misunderstanding in Ada 95, which is
> why we recently added the second message, since it is
> almost certain to be the right fix. Some Ada 95 programmers
> simply make a rule of using "ALL" for all access types.

In retrospect, I think the distinction between the two kinds of access
types (with and without "all") is not useful enough to have in the
language.  It's a little bit useful, but as you can see, it causes
confusion.  It would have been better to simply make all access types
behave like the "all" kind, and get rid of the "all" syntax.

That's what Tucker wanted to do in the first place, by the way.
He was convinced otherwise, partly by me.  :-(

- Bob
-- 
Change robert to bob to get my real email address.  Sorry.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-21  0:00       ` robert_dewar
@ 1999-01-21  0:00         ` Tom Moran
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Moran @ 1999-01-21  0:00 UTC (permalink / raw)


>Indeed, I agree. Meanwhile, it is not a bad idea at all
>to routinely use ALL,
I disagree.  There are significant differences between things
allocated on the heap with 'new' and things on the stack or fixed that
use 'all'.  Certainly something like a generic library routine might
want to be able to handle either kind, but, in my code at least, it's
very rare that the two are actually mixed.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-20  0:00     ` Robert A Duff
  1999-01-20  0:00       ` Matthew Heaney
@ 1999-01-21  0:00       ` robert_dewar
  1999-01-21  0:00         ` Tom Moran
  1 sibling, 1 reply; 14+ messages in thread
From: robert_dewar @ 1999-01-21  0:00 UTC (permalink / raw)


In article <wccu2xmq6k3.fsf@world.std.com>,
  Robert A Duff <bobduff@world.std.com> wrote:

> It would have been better to simply make all access types
> behave like the "all" kind, and get rid of the "all"
> syntax.


Indeed, I agree. Meanwhile, it is not a bad idea at all
to routinely use ALL, and in particular, exported access
types from standard packages should usually have ALL.
You will notice that the standard RM packages generally
follow this rule.

A coding style rule that requires the use of ALL on *all*
access types is not at all unreasonable.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-20  0:00       ` Matthew Heaney
  1999-01-20  0:00         ` Tucker Taft
@ 1999-01-21  0:00         ` robert_dewar
  1999-01-27  0:00         ` Nick Roberts
  2 siblings, 0 replies; 14+ messages in thread
From: robert_dewar @ 1999-01-21  0:00 UTC (permalink / raw)


In article <m390ex6fd3.fsf@mheaney.ni.net>,
  Matthew Heaney <matthew_heaney@acm.org> wrote:
> [general access types stuff]

> and makes this aspect of the language much harder to
> learn and teach.


"much" harder??

that's an exaggeration, this is a pretty minor point, and
hardly a big barrier to teaching or learning!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-20  0:00       ` Matthew Heaney
  1999-01-20  0:00         ` Tucker Taft
  1999-01-21  0:00         ` robert_dewar
@ 1999-01-27  0:00         ` Nick Roberts
  1999-01-28  0:00           ` robert_dewar
  2 siblings, 1 reply; 14+ messages in thread
From: Nick Roberts @ 1999-01-27  0:00 UTC (permalink / raw)


Matthew Heaney wrote ...
|But, are there any
|compilers that actually do have a different representation?

Mine (ThoughtWing Ada, out not soon I'm afraid), when targetting Intel 386
etc. It uses 32-bit offset for pool-specific access types, and 48-bit
segment+offset for general access types.

|Couldn't
|there have been another way to enable this alternate representation,
|such as a pragma?


Or a representation clause. Yes.

-------------------------------------------
Nick Roberts
-------------------------------------------







^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Conversion of Access Types Question
  1999-01-27  0:00         ` Nick Roberts
@ 1999-01-28  0:00           ` robert_dewar
  0 siblings, 0 replies; 14+ messages in thread
From: robert_dewar @ 1999-01-28  0:00 UTC (permalink / raw)


In article <78od69$b4t$1@plug.news.pipex.net>,
  "Nick Roberts" <Nick.Roberts@dial.pipex.com> wrote:
> Matthew Heaney wrote ...
> |But, are there any
> |compilers that actually do have a different
> |representation?
>
> Mine (ThoughtWing Ada, out not soon I'm afraid), when
> targetting Intel 386 etc. It uses 32-bit offset for
> pool-specific access types, and 48-bit segment+offset for
> general access types.

It's a natural enough idea if you actually want to fiddle
with the junk segment stuff on the ia32, but I think you
will find in practice that it causes a lot of problems to
make this choice, i.e. it will break a lot of assumptions
in existing code. As a compiler writer, you can of course
appeal to the standard, but if you actually want people to
use your compiler, you have to pay attention to how people
write code as well :-)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1999-01-28  0:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-14  0:00 Conversion of Access Types Question Paul S. Heidmann
1999-01-14  0:00 ` David C. Hoos, Sr.
1999-01-14  0:00   ` Paul S. Heidmann
1999-01-14  0:00     ` David C. Hoos, Sr.
1999-01-14  0:00     ` Tucker Taft
1999-01-15  0:00   ` dewar
1999-01-20  0:00     ` Robert A Duff
1999-01-20  0:00       ` Matthew Heaney
1999-01-20  0:00         ` Tucker Taft
1999-01-21  0:00         ` robert_dewar
1999-01-27  0:00         ` Nick Roberts
1999-01-28  0:00           ` robert_dewar
1999-01-21  0:00       ` robert_dewar
1999-01-21  0:00         ` Tom Moran

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