comp.lang.ada
 help / color / mirror / Atom feed
* Designated type of actual does not match that of formal "name"?
@ 2001-10-11 18:26 chris.danx
  2001-10-11 18:47 ` Designated type of actual does not match that of formal Ted Dennison
  2001-10-11 18:54 ` Designated type of actual does not match that of formal "name"? Sergey Koshcheyev
  0 siblings, 2 replies; 5+ messages in thread
From: chris.danx @ 2001-10-11 18:26 UTC (permalink / raw)


Hi,

I'm trying to instantiate an instance of Ada.Unchecked_Deallocation on a
type which is defined as follows

type xxx is new abc with private; -- where abc is abstract & limited;
type xxx_access is access all xxx'class;

I tried

procedure free is new ada.unchecked_deallocation (xxx, xxx_access);

but it doesn't work.  I get the error 'Designated type of actual does not
match that of formal "name"?'.  What am I missing?

If there isn't a way around this then the record type which holds an item of
type xxx_access will have to be limited (and hold an item of type xxx
instead).  That might not be such a bad idea in this instance, but I'd like
to know how what exactly the error means anyway.

Thanks,
Chris




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

* Re: Designated type of actual does not match that of formal
  2001-10-11 18:26 Designated type of actual does not match that of formal "name"? chris.danx
@ 2001-10-11 18:47 ` Ted Dennison
  2001-10-11 18:52   ` chris.danx
  2001-10-11 18:54 ` Designated type of actual does not match that of formal "name"? Sergey Koshcheyev
  1 sibling, 1 reply; 5+ messages in thread
From: Ted Dennison @ 2001-10-11 18:47 UTC (permalink / raw)


In article <gvlx7.5777$i14.731944@news2-win.server.ntlworld.com>, chris.danx
says...
>type xxx is new abc with private; -- where abc is abstract & limited;
>type xxx_access is access all xxx'class;
>
>I tried
>
>procedure free is new ada.unchecked_deallocation (xxx, xxx_access);
>
>but it doesn't work.  I get the error 'Designated type of actual does not
>match that of formal "name"?'.  What am I missing?

That's because it doesn't. xxx_access points to objects of type "xxx'class", not
xxx. Change one or the other to match, and it ought to work.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html

No trees were killed in the sending of this message. 
However a large number of electrons were terribly inconvenienced.



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

* Re: Designated type of actual does not match that of formal
  2001-10-11 18:47 ` Designated type of actual does not match that of formal Ted Dennison
@ 2001-10-11 18:52   ` chris.danx
  0 siblings, 0 replies; 5+ messages in thread
From: chris.danx @ 2001-10-11 18:52 UTC (permalink / raw)



"Ted Dennison" <dennison@telepath.com> wrote in message
news:gPlx7.24924$ev2.33632@www.newsranger.com...
> In article <gvlx7.5777$i14.731944@news2-win.server.ntlworld.com>,
chris.danx
> says...
> >type xxx is new abc with private; -- where abc is abstract & limited;
> >type xxx_access is access all xxx'class;
> >
> >I tried
> >
> >procedure free is new ada.unchecked_deallocation (xxx, xxx_access);
> >
> >but it doesn't work.  I get the error 'Designated type of actual does not
> >match that of formal "name"?'.  What am I missing?
>
> That's because it doesn't. xxx_access points to objects of type
"xxx'class", not
> xxx. Change one or the other to match, and it ought to work.

Thanks Ted




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

* Re: Designated type of actual does not match that of formal "name"?
  2001-10-11 18:26 Designated type of actual does not match that of formal "name"? chris.danx
  2001-10-11 18:47 ` Designated type of actual does not match that of formal Ted Dennison
@ 2001-10-11 18:54 ` Sergey Koshcheyev
  2001-10-11 19:25   ` chris.danx
  1 sibling, 1 reply; 5+ messages in thread
From: Sergey Koshcheyev @ 2001-10-11 18:54 UTC (permalink / raw)



"chris.danx" <chris.danx@ntlworld.com> wrote in message
news:gvlx7.5777$i14.731944@news2-win.server.ntlworld.com...
> Hi,
>
> I'm trying to instantiate an instance of Ada.Unchecked_Deallocation on a
> type which is defined as follows
>
> type xxx is new abc with private; -- where abc is abstract & limited;
> type xxx_access is access all xxx'class;
>
> I tried
>
> procedure free is new ada.unchecked_deallocation (xxx, xxx_access);
>
> but it doesn't work.  I get the error 'Designated type of actual does not
> match that of formal "name"?'.  What am I missing?

Well, you're trying to pass it xxx as the object, but pointer to xxx'class
as the pointer. This is what it doesn't like, since xxx /= xxx'class. Either
pass xxx'class as the first parameter, or pointer to xxx as the second.

> If there isn't a way around this then the record type which holds an item
of
> type xxx_access will have to be limited (and hold an item of type xxx
> instead).  That might not be such a bad idea in this instance, but I'd
like
> to know how what exactly the error means anyway.

The type is not required to be limited for Unchecked_Deallocation.

Sergey Koshcheyev.





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

* Re: Designated type of actual does not match that of formal "name"?
  2001-10-11 18:54 ` Designated type of actual does not match that of formal "name"? Sergey Koshcheyev
@ 2001-10-11 19:25   ` chris.danx
  0 siblings, 0 replies; 5+ messages in thread
From: chris.danx @ 2001-10-11 19:25 UTC (permalink / raw)



> > If there isn't a way around this then the record type which holds an
item
> of
> > type xxx_access will have to be limited (and hold an item of type xxx
> > instead).  That might not be such a bad idea in this instance, but I'd
> like
> > to know how what exactly the error means anyway.
>
> The type is not required to be limited for Unchecked_Deallocation.

No, but the other possibility (if the error was not simple to fix, which
fortunately it is) was to simply use an item of type xxx instead of an item
of type access to xxx (which probably should have been the case in the first
place).  The language enforces that a record containing a limited type is
also 'limited' if i remember correctly, hence the need for some
modification.

In this instance it made sense to make the type limited since it's meant to
represent a file and assignment and equality don't apply in the sense that
they would to another type.  The type and it's associated subprograms have
been modified to make it limited.

Thanks for the info,
Chris





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

end of thread, other threads:[~2001-10-11 19:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-11 18:26 Designated type of actual does not match that of formal "name"? chris.danx
2001-10-11 18:47 ` Designated type of actual does not match that of formal Ted Dennison
2001-10-11 18:52   ` chris.danx
2001-10-11 18:54 ` Designated type of actual does not match that of formal "name"? Sergey Koshcheyev
2001-10-11 19:25   ` chris.danx

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