Charles Hixson:

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?

A D bool is a C99 uint8_t that has values just 0 or 1.

If your uint8_t contains a value x > 1, in many cases this works, but some D code relying on the standard values of a D boolean breaks (like when you sum bool values in D, to count the true ones).

D doesn't handle those conversions beside the narrowing or extension of bit-width lengths.

Bye,
bearophile

Reply via email to