WININET: make WCHAR strings const where possible
Shachar Shemesh
wine-devel at shemesh.biz
Sat Apr 17 16:28:44 CDT 2004
Francois Gouget wrote:
> I wrote a teeny test app to check this out and you're right. The static
>
>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.
>
>
>
Of 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.
Try implementing it yourself, and you will get warnings in both languages.
Shachar
--
Shachar Shemesh
Lingnu Open Source Consulting
http://www.lingnu.com/
More information about the wine-devel
mailing list