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,693c0db9fd624c1d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-28 10:17:15 PST Path: news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: C Integers -> Booleans: shortcut? Date: 28 Sep 2003 18:15:26 +0100 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <7bEdb.1944$QH3.1487@newsfep4-winn.server.ntli.net> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1064769433 8413 62.49.19.209 (28 Sep 2003 17:17:13 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sun, 28 Sep 2003 17:17:13 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: news1.google.com comp.lang.ada:77 Date: 2003-09-28T18:15:26+01:00 List-Id: chris writes: > Can you (in general) import a function taking/returning a C integer > and treat it like a boolean for import? Let the compiler deal with > the difference? With GNAT you would say type C_Boolean is new Boolean; pragma Convention (C, C_Boolean); with the meaning that 0 => False, anything else => True. For other compilers I would think you'd be better off specifying Interfaces.C.int and comparing to 0.