« first day (3411 days earlier)      last day (1523 days later) » 

3:25 AM
I am having issue with 'atof' on Raspberry Pi.
char pi[] = "3.1415926535";
double pi_val = atof(pi);
printf( "Pi is %lf\n", pi_val);
And I am getting:
Pi is -1097056292.000000
What heck could be the case?
 
 
1 hour later…
4:49 AM
10
A: Atof not working?

StephenAre you including stdlib.h ?? I find if i dont explicitly import stdlib.h the code complies and runs, but atof returns 0, when i include stdlib.h it returns the value as expected. Im using the gcc for c code. I assume its the same for c++.

Who would have thought ...
So this is the answer. Failing silently is way more dangerous than loud errors.
 
5:04 AM
 
 
13 hours later…
6:02 PM
posted on February 17, 2020 by Herb Sutter

C++ “move” semantics are simple, but they are still widely misunderstood. This post is an attempt to shed light on that situation. Thank you to the following for their feedback on drafts of this material: Howard Hinnant (lead designer and author of move semantics), Jens Maurer, Arthur O’Dwyer, Geoffrey Romer, Bjarne Stroustrup, Andrew Sutton, Ville … Continue reading Mov

 
 
4 hours later…
10:08 PM
@TelKitty difficult to tell but not all float can be interpreted so chances are that you're falling into one of those cases
 

« first day (3411 days earlier)      last day (1523 days later) »