Question

Today I found this is in an example file given to me by a company:

void mySgemm( int m, int n, int k, float alpha, float beta, float a[m][n],   float b[n][k], float c[m][k], int accelerate )

Called with:

a_cpu = malloc(..);
b_cpu = malloc(..);
c_cpu = malloc(..);
mySgemm(m, n, k, a, b, a_cpu, b_cpu, c_cpu, true);

I can't compile my own similar example, frankly I've never even seen someone take a dynamic array and shape it as such using the function parameters themselves.

Is this a legal call?


What boggles my mind is that in the mySgemm function they access a,b,c as double arrays, so the array is essentially being reshaped!?

Was it helpful?

Solution

no, it's not valid c++.

i guess the formal argument declarations would pass in c99, as variadic arrays, but i'm not so sure that the actual arguments for those would be accepted

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top