← Back to team overview

leaningtech-dev team mailing list archive

[Bug 1393017] Re: error:Field not supported in union.

 

such as 
float b = *(cheerp_cast<float *>(_socket_buffer));  _socket_buffer+=4;

should convert the code to


inine floart× cheerp_cast_to_float_from_char(char* in_c)
{
  union
  {
     float f;
     char c[4];
  } u_cheerp_cast_to_float_from_char;

 static u_cheerp_cast_to_float_from_char convert;

 convert.c[0] = in_c[0];
 convert.c[1] = in_c[1];
 convert.c[2] = in_c[2];
 convert.c[3] = in_c[3]; //I think 4 bytes , memcpy is slower than this.

return &u_cheerp_cast_to_float_from_char.f;

}


float b = *(cheerp_cast_to_float_from_char(_socket_buffer)); 

if you deal cheerp_cast as a pretreatment, cheerp can out put a
converted file for user to check whether the conversion is correct.

-- 
You received this bug notification because you are a member of
Leaningtech Team, which is subscribed to Cheerp.
https://bugs.launchpad.net/bugs/1393017

Title:
  error:Field not supported in union.

Status in Cheerp: C++ for the Web:
  Invalid

Bug description:
  is the error means, cheerp does not support union?

To manage notifications about this bug go to:
https://bugs.launchpad.net/cheerp/+bug/1393017/+subscriptions


References