Handling big FP numbers

H. S. Teoh hsteoh at quickfur.ath.cx
Sat Feb 9 05:51:27 UTC 2019

On Sat, Feb 09, 2019 at 04:36:26AM +0000, DanielG via Digitalmars-d-learn wrote:
> On Saturday, 9 February 2019 at 04:32:44 UTC, Murilo wrote:
> > Thank you very much for clearing this up. But how do I make D
> > behave just like C? Is there a way to do that?
> Off the top of my head, you'd have to link against libc so you could
> use printf() directly.

There's no need to do that, D programs already link to libc by default.
All you need is to declare the right extern(C) prototype (or just import
core.stdc.*) and you can call the function just like in C.  With the
caveat, of course, that D strings are not the same as C's char*, so you
have to use .ptr for string literals and toStringz for dynamic strings.


People tell me I'm stubborn, but I refuse to accept it!

More information about the Digitalmars-d-learn mailing list