comp.lang.ada
 help / color / mirror / Atom feed
From: scifi!hawnews.watson.ibm.com!yktnews.watson.ibm.com!ncohen@uunet.uu.net   (Norman H. Cohen)
Subject: Re: Generic Pointer Type
Date: 7 Sep 93 15:58:55 GMT	[thread overview]
Message-ID: <CCzr27.ICA@yktnews.watson.ibm.com> (raw)

In article <2689cj$4m1@pdq.coe.montana.edu>, hoffman@cs.montana.edu (Brad
Hoffman) writes: 

|> Hello, I am a serious Ada rookie and am trying to figure out if it is
|> possible to declare a "void-type pointer".  Is this possible, and if so, how
|> do I do it?

The short answer is no:  Every access type in Ada is declared to point to
objects of one particular type.

The longer answer is:  Ada has various mechanisms for doing the kinds of
things C programmers do with void *.  Some of these things are
unnecessary in Ada.  (For example, unlike a call on malloc, an Ada
allocator returns a value of the desired access type.)  Others are
considered to be of questionable propriety in Ada.  (For example, there
is a way to convert an access value pointing to type A to an access value
pointing to type B so that an object of type A can be manipulated as if
it were of type B.  This is sometimes necessary, but in most cases there
are better ways to get the job done.)

Why don't you tell us what problem led you to believe you needed a
void-type pointer?  Then we can discuss the way that problem is solved in
Ada.

--
Norman H. Cohen    ncohen@watson.ibm.com

             reply	other threads:[~1993-09-07 15:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-07 15:58 Norman H. Cohen [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-09 17:44 Generic Pointer Type Bev in R. Brett
1993-09-09 14:59 Wes Groleau x1240 C73-8
1993-09-08 19:25 cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!progers
1993-09-08 18:36 David Emery
1993-09-08 15:51 cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!progers
1993-09-07 19:18 dog.ee.lbl.gov!agate!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!swrind
1993-09-04  0:17 Robert Dewar
replies disabled

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