Is it legal/safe to cast away `const` for a heap-allocated object?
问题 My use case is as follows. I develop a library in which some loaded plugins can create objects (allocated using malloc() by the library), and some other plugins can read properties of those objects but not modify them. For me this is a case of having a non- const API for the creating/writer side and a const API for the reader side, for example: // writer API struct obj *obj_create(void); void obj_set_some_property(struct obj *obj, int property); // reader API int obj_get_some_property(const