Message from C, C++ talks

June 2019

— Maximum two, when someone wants to pass a pointer to a C-array. To allocate it in the function and return the pointer via parameter

Message permanent page

— But three asterisks sound a little bit insane. Can't imagine why someone would do that

— Well, two already too bad in my opinion

— But I guess its how things being done in pure C (glad that I'm not doing pure C)

— 

Kind of, multiple function invocations would share the object. To access the object outside of the function you need a pointer.

— Multi dimensional arrays

— Oh, so to have 3d array of ints, you need to do this int***?

— Well vector<vector<vector<...>>>> doesn't sound much better, but at least it's safe :)

— But memory-unpredictable

— I think at least the same predictable as with C arrays

— I still didn't understand why do we need to flush the buffer.

— So ..
int[2][3][4] would be int(*+2)(*+3)(*+4) ?

— The problem with std::vector is that the compiler will generate a full set of functions for each template

Message permanent page

— Or however pointer-arithmetic is done. 😅

— + classes are bloat