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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9b05d372d1b25f25 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!m36g2000hse.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Interfacing to C and types visible to Ada Date: Thu, 3 Jul 2008 13:35:21 -0700 (PDT) Organization: http://groups.google.com Message-ID: <54890030-8e2e-4a93-af1d-ce691746080a@m36g2000hse.googlegroups.com> References: NNTP-Posting-Host: 85.3.87.63 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1215117321 27067 127.0.0.1 (3 Jul 2008 20:35:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 3 Jul 2008 20:35:21 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m36g2000hse.googlegroups.com; posting-host=85.3.87.63; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:999 Date: 2008-07-03T13:35:21-07:00 List-Id: On 3 Lip, 21:35, Keith Thompson wrote: > Study the C API and come up with a description of what the type is > actually used for. It is used for integers. That's the problem. :-) > I'm not sure I understand this "domainless" business. Can you provide > a simple example? Sure. The C library is a database access library. It allows the user to transmit data of various types, which are all "domainless". One of these types is, well, integer. Whether it is a "room number" or "number of apples" depends on the actual application, but the database access library does not influence it. It is really an integer, having a value in some range. The range happens to be defined by C's int, which on the particular compiler is 32-bit, signed. The Ada wrapper should expose this type as "some" integer as well, but I have doubts which integer is best. I think that the suggestion to have subtype or derivation from Integer.C.int make the most sense. User applications will use their own types anyway and the casts from/to the "database integer" are unavoidable. I also like the solution with generic parameter (Ludovic), but it will not be consistent with other supported types like string and timestamp, for which the natural mapping choices are String and Ada.Calendar.Time. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com