comp.lang.ada
 help / color / mirror / Atom feed
* Function returning "Boolean" in a binding
@ 2000-12-23  2:47 Antonio Vargas
  2000-12-23 15:36 ` Ted Dennison
  0 siblings, 1 reply; 4+ messages in thread
From: Antonio Vargas @ 2000-12-23  2:47 UTC (permalink / raw)



Hi 

(Sorry about the bad English :-)  )

I'm making a public binding to the SDL graphics library and
I'm studying other bindings in other to make things right.

In the process of testing  adabindx-0.7.1 under Gnat 3.13p

I've found this problem.

With Gnat I can't compile this code, accusing an internal bug:

   type Xt_Work_Proc is access function (Client_Data : in Xt_Pointer)
      return Boolean; 
   pragma Convention (C, Xt_Work_Proc);


But if I change  the return type form  "Boolean" to "Interfaces.C.Int"
it compiles.  Shouldn't the compiler  make an automatic conversion
from Boolean(Ada side) to C.int  (C side) ?. 

Is it  just a gnat bug  or a bug and non-standard coding,  since
I can't find nothing related to that in the ARM  or Gnat docs?

Thanks in advance.

Antonio Vargas




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Function returning "Boolean" in a binding
  2000-12-23  2:47 Function returning "Boolean" in a binding Antonio Vargas
@ 2000-12-23 15:36 ` Ted Dennison
  2000-12-23 16:29   ` Antonio Vargas
  0 siblings, 1 reply; 4+ messages in thread
From: Ted Dennison @ 2000-12-23 15:36 UTC (permalink / raw)


In article <977543301.615948@cachalote.ip.pt>,
  antonio.vargas@clix.pt wrote:

   type Xt_Work_Proc is access function (Client_Data : in Xt_Pointer)
>       return Boolean;
>    pragma Convention (C, Xt_Work_Proc);
>
> But if I change  the return type form  "Boolean" to "Interfaces.C.Int"
> it compiles.  Shouldn't the compiler  make an automatic conversion
> from Boolean(Ada side) to C.int  (C side) ?.

Why? How does the compiler know that's what you want Boolean to map to?
You could want to use it for a C "char" for all it knows.


--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com
http://www.deja.com/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Function returning "Boolean" in a binding
  2000-12-23 15:36 ` Ted Dennison
@ 2000-12-23 16:29   ` Antonio Vargas
  2000-12-24 13:14     ` Marc A. Criley
  0 siblings, 1 reply; 4+ messages in thread
From: Antonio Vargas @ 2000-12-23 16:29 UTC (permalink / raw)




  
   I thought that conversion from Boolean to C.int was conventioned (I read 
that somewhere ).

   But anyway since it is something dubious,  the compiler should complain
about undefined conversion Instead of  the message "Internal bug". 

  And then I'm surprised that they used such a thing in the binding in 
question.

Antonio Vargas

Ted Dennison wrote:

> In article <977543301.615948@cachalote.ip.pt>,
>   antonio.vargas@clix.pt wrote:
> 
>    type Xt_Work_Proc is access function (Client_Data : in Xt_Pointer)
>>       return Boolean;
>>    pragma Convention (C, Xt_Work_Proc);
>>
>> But if I change  the return type form  "Boolean" to "Interfaces.C.Int"
>> it compiles.  Shouldn't the compiler  make an automatic conversion
>> from Boolean(Ada side) to C.int  (C side) ?.
> 
> Why? How does the compiler know that's what you want Boolean to map to?
> You could want to use it for a C "char" for all it knows.
> 
> 
> --
> T.E.D.
> 
> http://www.telepath.com/~dennison/Ted/TED.html
> 
> 
> Sent via Deja.com
> http://www.deja.com/
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Function returning "Boolean" in a binding
  2000-12-23 16:29   ` Antonio Vargas
@ 2000-12-24 13:14     ` Marc A. Criley
  0 siblings, 0 replies; 4+ messages in thread
From: Marc A. Criley @ 2000-12-24 13:14 UTC (permalink / raw)


Yes, "Internal bug" would not be a sanctioned GNAT error message for
this situation.  You ought to send a bug report to report@gnat.com
describing exactly what you saw, and if possible providing a standalone
program that demonstrates the problem.

When you got the "Internal bug" message you were informed of this via a
GNAT "bug box", yes?  Just follow the directions it displays.

Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com

Antonio Vargas wrote:
> 
> 
>    I thought that conversion from Boolean to C.int was conventioned (I read
> that somewhere ).
> 
>    But anyway since it is something dubious,  the compiler should complain
> about undefined conversion Instead of  the message "Internal bug".
> 
>   And then I'm surprised that they used such a thing in the binding in
> question.
> 
> Antonio Vargas
> 
> Ted Dennison wrote:
> 
> > In article <977543301.615948@cachalote.ip.pt>,
> >   antonio.vargas@clix.pt wrote:
> >
> >    type Xt_Work_Proc is access function (Client_Data : in Xt_Pointer)
> >>       return Boolean;
> >>    pragma Convention (C, Xt_Work_Proc);
> >>
> >> But if I change  the return type form  "Boolean" to "Interfaces.C.Int"
> >> it compiles.  Shouldn't the compiler  make an automatic conversion
> >> from Boolean(Ada side) to C.int  (C side) ?.
> >
> > Why? How does the compiler know that's what you want Boolean to map to?
> > You could want to use it for a C "char" for all it knows.
> >
> >
> > --
> > T.E.D.
> >
> > http://www.telepath.com/~dennison/Ted/TED.html
> >
> >
> > Sent via Deja.com
> > http://www.deja.com/
> >



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-12-24 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-23  2:47 Function returning "Boolean" in a binding Antonio Vargas
2000-12-23 15:36 ` Ted Dennison
2000-12-23 16:29   ` Antonio Vargas
2000-12-24 13:14     ` Marc A. Criley

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