First off let me state that I understand the difference between:
const char *a;
and
char * const a;
and
const char * const a;
However lately I am repeatedly encountering the latter when being used to pass parameters to a function, to give an example the Maxmind GeoLite2 mmdb C API for reading the database files uses the following format for every pointer parameter:
const T * const
Example: https://github.com/maxmind/libmaxminddb/blob/master/include/maxminddb.h#L203
extern int MMDB_open(const char *const filename, uint32_t flags, MMDB_s *const mmdb);
I have a solid understanding of C/C++ and the x86 or x86-64 that C/C++ is often compiled into and I understand that the pointer to the filename and the pointer to the MMDB_s are both stack-allocated copies (or passed by register in the case of x86-64) so what purpose is there to make the pointer const?
Am I missing something here or are they unnecessarily flooding their API with const pointers which really have no end effect on the person using them?