I'm developing a piece of code which makes scientific calculation, and as a result I use extensive use of double
variables. These variables travel from function to function, but most of them are never modified and hence defined as const
in function signatures.
I have used double*
in function signatures, but then I started to wonder that whether it's better to use double
instead because:
double*
anddouble
are same size, 8 bytes in C++.- When I send in
double*
, I need another fetch operation in the function.
When using the variables in const
fashion, are there any valid reasons to use double*
instead of double
?