In this case, the value is used on a templated function where the deducted type is based on that constant, so the kernel essentially gets fixed to double precision and not T.
There are several other models that does T sum = 0.0; which is probably OK.
But for consistency I think we should probably be using aggregate initialisation for everything:
There are several instances where the double constant
0.0
is used in a way that promotes everything it touches. For example: https://github.com/UoB-HPC/BabelStream/blob/1d423fc70dd573b528ee43f521401277731b443a/src/std-data/STDDataStream.cpp#L85In this case, the value is used on a templated function where the deducted type is based on that constant, so the kernel essentially gets fixed to double precision and not
T
.There are several other models that does
T sum = 0.0;
which is probably OK. But for consistency I think we should probably be using aggregate initialisation for everything: