Windows Variant Coercion Rules?

  • Thread starter Thread starter Martin Ba. _
  • Start date Start date
M

Martin Ba. _

Guest
Original on SO: http://stackoverflow.com/questions/41129804/windows-variant-coercion-rules


I have a Windows VARIANT holding a BSTR with a (supposedly) numeric value.

I want to use VariantChangeType to convert this BSTR value to a VT_I4 or VT_I8 or ...

To my surprise, passing in a string value of "5.6", . being my decimal separator, the function succeeds for integer conversion, and the resulting lValor llVal value is 6! I would have expected either a conversion error, or a value of 5, which is what sscanf gives me.

--> Is there any documentation for the conversion rules used by the VARIANT conversion functions? <--

I found that VariantChangeType is implemented through (e.g.) VarI4FromStr, but there is zero info wrt. the conversion rules used by this function.

Continue reading...
 
Back
Top