of multiple inputs) with the same logic – a form of generic programming. This problem arises even for simple functions in the C standard library, notably strchr; this observation is credited by Ritchie to Tom Plum in the mid 1980s. The strchr function locates a character in a string; formally, it returns a pointer to the first occurrence of the character c in the string s, and in classic C (K&R C) its prototype is: char *strchr(char *s, int c); The strchr function does not modify the input string, but the return value is often used by the caller to modify the string, such as: if (p = strchr(q, '/')) *p = ' '; Thus on the one hand the input string can be const (since it is not modified by the function), and if the input string is const the return value should be as well – most simply because it might return exactly the input pointer, if the first character is a match – but on the other hand the return value should not be const if the original string was not const, since the caller may wish to use the pointer to modify the original string. In C++ this is done via function overloading, typically implemented via a template, resulting in two functions, so that the return value has the same const-qualified type as the input: char* strchr(char* s, int c); char const* strchr(char const* s, int c); These can in turn be defined by a template: template <T> T* strchr(T* s, int c) { ... } In D this is handled via the inout keyword, which acts as a wildcard for const, immutable, or unqualified (variable), yielding: inout(char)* strchr(inout(char)* s, int c); However, in C neither of these is possible since C does not have function overloading, and instead, this is handled by having a single function where the input is constant but the output is writable: char *strchr(char const *s, int c); This allows idiomatic C code but does strip the const qualifier if the input actually was const-qualified, violating type safety. This solution was proposed by Ritchie and subsequently adopted. This difference is one of the failures of compatibility of C and C++. Since C23, this problem is solved with the use of generic functions. strchr and the other functions affected by the issue will return a const pointer if one was passed to