This is a theoretical question for C and C ++.
I have a 4x4 matrix type that is defined simply like this:
typedef float Matrix44[16];
I also have many methods that take Matrix44as a parameter, for example:
bool matrixIsIdentity(Matrix44 m);
I also have a special memory allocation scheme in which a large area of memory is pre-allocated on the heap, and then I manually manage the allocations in this pre-loaded memory. So I replaced / overloaded malloc/ newwith my own implementations. The problem is that both user mallocand newby nature return a pointer, not an object.
Usually I just did the following:
1] Matrix44 mat = { ... };
2] bool res = matrixIsIdentity(mat);
1 mat , , . :
1] Matrix44 *mmat = myMalloc(...);
1a] Matrix44 *nmat = new ...
2] bool res = matrixIsIdentity(*mat);
, . Matrix44*, , , , .
: C / ++, Method 1 Line 1, ( Method 2 Line 1)?
( , , , )