That is a mistake that I only discovered after releasing 3.30. It should
of course be:
void OxValSetDouble(OxVALUE *pv, double dVal);
It is also wrong in oxexport.h, which makes it impossible to use that
function until the next release of Ox.
The function simply is:
void OXCALL OxValSetDouble(OxVALUE *pv, double dVal)
{
if (pv)
{ OxFreeByValue(pv);
OxSetDbl(pv, 0, dVal);
}
}
The main thing to note is that it frees the existing content of pv.
Normally pv would be managed by the Ox run-time system, so this is not
of concern. However, occasionally OxVALUEs are used as local variables
in external code. In that case, they should be initialized to integer 0
(or some other value), to avoid trying to free invalid data. (Because
this is C, and not C++, there is no constructor to do this automatically.)
Jurgen.
Max Bruche wrote:
> Hello Ox-Users,
>
> Looking at page 33 of my Ox Appendices (A 2.2 Ox function summary), I see
> the following signature
>
> OxValSetDouble(OxVALUE* pv, int dVal)
>
> To me this looks like a function that is meant to set (*pv) to an ox double
> - but if this is the case, then why does it take an int as an argument?
>
> I am confused.
>
> Regards,
> Max
>
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
Dr Jurgen A Doornik
Nuffield College, Oxford OX1 1NF, UK
tel. UK: +44-1865-278610 fax +44-1865-278621
http://www.nuff.ox.ac.uk/Users/Doornik/
http://www.oxmetrics.net
http://www.oxedit.com
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
|