2 ms·
How does this know the difference between: const char *cls::func(void) { return "abc"; // static: caller must not free } and const char *cls::fu
by kazinator 8y ago
How does this know the difference between:
const char *cls::func(void)
{
return "abc"; // static: caller must not free
}
and
const char *cls::func(void)
{
return strdup("abc"); // caller must free
}
Edit: I see: designed for large scale programs in high performance computing that use modern C++.
Modern C++ meaning, no pointers anywhere.
- progval 8y agoIt looks like this gives you a `ctypes` pointer: https://cppyy.readthedocs.io/en/latest/basic_types.html#pointers https://cppyy.readthedocs.io/en/latest/basic_types.html#poin... So you handle it like any other ctypes pointer, ie. `libc = ctypes.CDLL(find_library("c")); libc.free(ptr)` Which is not fun in Python. So yeah, better avoid raw pointers.