Is this usage of the const keyword in line with its intention?
问题 I am designing an API and am considering the use of "immutable" structs", or "read-only structs". Using a simplified example, this could look something like: struct vector { const float x; const float y; }; struct vector getCurrentPosition(void); struct vector getCurrentVelocity(void); Everything works fine as long as I return the immutable struct on the stack. However, I run into issues when implementing a function like: void getCurrentPositionAndVelocity( struct vector *position, struct