Suppose I have two different functions(C), the only difference between them is that some of their arguments are of different datatypes(I'm thinking about CBLAS right now). For example:
void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
const int K, const double alpha, const double *A,
const int lda, const double *B, const int ldb,
const double beta, double *C, const int ldc);
void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
const int K, const float alpha, const float *A,
const int lda, const float *B, const int ldb,
const float beta, float *C, const int ldc);
Instead of having this function defined twice, just with some datatypes different, Is there a smarter way to have these two functions? like a compiler directive or something?
EDIT(Not sure if this question is allowed by stackoverflow): I'm thinking about how these functions look after being compiled.Am I right in thinking this? "Since single precision addition and double precision addition are different instructions in the hardware level, even if the C compiler was modified to allow the kind of functions the question talks about, the final binaries would be similar because we would need to have two different functions in the binary too?"