Hi Greg,
I apologize for the slightly misleading example I provided. It was just a
simple example name for a function that would let the people viewing it
know it doesn't modify anything.
A better example would be something like this:
ssize_t mfs_read_page(FAR const struct mfs_sb_s * const sb,
Hi all,
First up, I am extremely sorry for the late response. I traveled the entire
day and finally reached a place with network coverage.
Thank you, Michal, this clears up my confusion. I was wondering if the
compiler is smart enough for more complex cases.
And compiler can easily determine if
That is correct. I was not suggesting to change the interface. We were
only using read() as an example.
We were basically saying this:
If a function promises not to modify a buffer, its definition should
contain const like this:
void function_that_does_not_modify_buffer(const uint8_t * buffer);