I wrote a teeny test app to check this out and you're right. The staticOf course there is no warning. You are casting away the "const" by using strchr. The lack of overloading means that it must be defined as accepting const pointer, but returning non-const pointer. In effect, it removes the pointer's constantness.
is crucial. If it's not specified the string is copied to the stack so that the const essentially has no effect whatsoever (no compiler warning and no runtime error). With 'static const' we still don't get a compiler warning (tested with gcc version 3.3.3 (Debian 20040321)) but we get a runtime crash, i.e. the string is really const this time.
Try implementing it yourself, and you will get warnings in both languages.
Shachar
-- Shachar Shemesh Lingnu Open Source Consulting http://www.lingnu.com/