The following code fails to compile for me (gcc 4.6.3, Ubuntu 12.04):
#include
#include
static inline void adjustBuffer(cons
Passing an uint8_t *
as a const uint8_t *&
parameter would allow the function to replace the unint8_t *
with a const uint8_t *
. Now there is a const uint8_t *
in the place where the caller expects a modifiable uint8_t *
. This is not save, since the caller might modify the pointed-to data after the function returned.
The problem is the same as in this C++ FAQ lite section.