in reply to Re: [OT(C)] float parameter treated as double by callee -- but it fails with FFI
in thread [OT(C)] float parameter treated as double by callee -- but it fails with FFI
Exactly, in TIFF.xs double is simply cast to float, no issues with that. My confusion was about line 337, where double is expected as argument. But, what I just found in plain Wikipedia:
Another consideration is the default argument promotions applied to the unnamed arguments. A float will automatically be promoted to a double. Likewise, arguments of types narrower than an int will be promoted to int or unsigned int. The function receiving the unnamed arguments must expect the promoted type.
That answers my question about libtiff code. And, perhaps implicitly, addresses the question about FFI: for variadic functions, promoted args types must be specified (i.e. not float, but double). OK, now I'm educated:)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: [OT(C)] float parameter treated as double by callee -- but it fails with FFI
by syphilis (Archbishop) on Jun 30, 2021 at 00:30 UTC | |
Re^3: [OT(C)] float parameter treated as double by callee -- but it fails with FFI
by ikegami (Patriarch) on Jul 01, 2021 at 23:10 UTC | |
by ikegami (Patriarch) on Jul 01, 2021 at 23:42 UTC |
In Section
Seekers of Perl Wisdom