From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,43b6c5f649185450 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-04 21:42:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: generic type identification References: X-Newsreader: Tom's custom newsreader Message-ID: <9BPR9.448239$GR5.153733@rwcrnsc51.ops.asp.att.net> NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1041745349 12.234.13.56 (Sun, 05 Jan 2003 05:42:29 GMT) NNTP-Posting-Date: Sun, 05 Jan 2003 05:42:29 GMT Organization: AT&T Broadband Date: Sun, 05 Jan 2003 05:42:29 GMT Xref: archiver1.google.com comp.lang.ada:32562 Date: 2003-01-05T05:42:29+00:00 List-Id: > I wish it was this simple but as you will probably pass OpenGL alot of > vertices every frame (if there are lots of stuff changing in the scene) you > don't want to pass it 64bit doubles if 32bit floats are enough. Same goes > for int vs short. So you surely don't want to spend execution time figuring out what "type" was passed in. If I understand correctly, you have a set of C procedures like something_int(int x); something_short(short x); something_float(float x); something_double(double x); etc. and you want to get the compiler to figure out which one to call? How about package Short_Forms is subtype Distances is Interfaces.C.Short; procedure Something(x : in Distances); procedure Other_Thing(x : in Distances); end Short_Forms; package Int_Forms is subtype Distances is Interfaces.C.Int; procedure Something(x : in Distances); procedure Other_Thing(x : in Distances); end Int_Forms; package Float_Forms is subtype Distances is Interfaces.C.C_Float; procedure Something(x : in Distances); procedure Other_Thing(x : in Distances); end Float_Forms; and then 'with' and 'use' the appropriate one in each calculation package? with Int_Forms; use Int_Forms; package body Draw_Stuff is x,y : Distances; ... Something(x); Does that match what you are trying to do?