In my opinion, if you want to design ReceiveDataWithHeader to have a flexible interface to cater for buffers of different sizes, then either go for an interface in which there is begin/end pointer parameters to denote the range of the buffer, or in which there is a pointer parameter and also a size parameter. The former is akin to the approach taken by standard algorithms; the latter is a common approach for arrays in C. Doing the conventional follows the principle of least surprise.