Closed vitcpp closed 10 months ago
@esabol It is interesting, that I tried this:
sprintf(&buf[0], "%.*gd, (int)sphere_output_precision, ...
And I found that it doesn't fix the warning on my side. I use gcc 11.3.0. The warning is enabled by -Wformat-overflow. Some heuristic in gcc is used in this case. It seems it somehow defines that sphere_output_precision may be much greater than DBL_DIG. I can't explain why such change doesn't fix the warning but change the type to int fixes it.
The warnings are fixed for Focal dist. The rest will be fixed in PR #39. Lets incorporate this patch first, #39 will be the next.
The variable sphere_output_precision type is changed to int because sprintf requires this argument to be of type int when used as the precision specificator (argument for '*' symbol in the sprintf template).