Write binary data, const definition and reinterpret_cast

Sep 12, 2011 at 6:29am
I have a doubt with this.

I have the typical function to write data to a binary file.
( reinterpret_cast< char*> (&value); )

A function can be written so:
1: void My_function_write( const double & value)
2: void My_function_write( double & value)

Are going to be faster 1 than 2 ?
In case of you recommend to use 1, I have to do some const_cast before the reinterpret_cast from double to char. So the question is the same: in this case 1 has become slower than 2 ?

Any explanation ? Thanks.-
Sep 12, 2011 at 6:33am
Why are you storing a char* as a double in the first place?
Sep 12, 2011 at 3:15pm
mmm.
You're right. I have seen the << operator ......
Thanks.
Topic archived. No new replies allowed.