comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: C Integers -> Booleans: shortcut?
Date: 28 Sep 2003 18:15:26 +0100
Date: 2003-09-28T18:15:26+01:00	[thread overview]
Message-ID: <x7vpthkrg0h.fsf@smaug.pushface.org> (raw)
In-Reply-To: 7bEdb.1944$QH3.1487@newsfep4-winn.server.ntli.net

chris <spamoff.danx@ntlworld.com> 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.



  reply	other threads:[~2003-09-28 17:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-28 16:46 C Integers -> Booleans: shortcut? chris
2003-09-28 17:15 ` Simon Wright [this message]
2003-09-28 18:17   ` chris
2003-09-29 20:19   ` Randy Brukardt
replies disabled

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