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 11:27:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: generic type identification References: <_BAR9.4055$FF4.251139@newsb.telia.net> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1041708441 12.234.13.56 (Sat, 04 Jan 2003 19:27:21 GMT) NNTP-Posting-Date: Sat, 04 Jan 2003 19:27:21 GMT Organization: AT&T Broadband Date: Sat, 04 Jan 2003 19:27:21 GMT Xref: archiver1.google.com comp.lang.ada:32539 Date: 2003-01-04T19:27:21+00:00 List-Id: >For instance, glVertex has 24 different declarations depending on whether >you use (C) floats, doubles, integers, shorts etc and whether your send it So you don't really need to know the "type" in the Ada sense of the word, just in the C sense. If it's OK to call the "double" version for any float, and the "int" version for shorts as well as ints, then one generic for int and one for double should do the job. So how about: generic type An_Integer_Type is range <>; type A_Float_Type is digits <>; package Example procedure Some_Procedure(Item: in An_Integer_Type); procedure Some_Procedure(Item: in A_Float_Type); end Example; package body Example is procedure Some_Procedure(Item: in An_Integer_Type) is begin gl_i_SomeProcedure(Interfaces.C.Int(Item));end Some_Procedure; procedure Some_Procedure(Item: in A_Float_Type) is begin gl_d_SomeProcedure(Interfaces.C.Double(Item));end Some_Procedure; end Example;