extern(C) bool function type?

Jacob Carlborg doob at me.com
Thu Sep 26 12:28:42 PDT 2013


On 2013-09-26 20:56, Charles Hixson wrote:
> Does anyone know:
> If an extern(c) function is defined as returning a bool, does D handle
> the conversion automatically into true and false?  Should it be defined
> as returning  an int?  On a 64 bit machine?  Does this depend on the
> compiler used to compile the library?  int32_t? int_64_t?
>
> Is this portable or non-portable?

In general 0 is false and all other integers are true. So if the 
function returns 0 or 1 it will automatically work for true and false as 
well.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list