Hello, James!
I agree with you. But, unfortunately, the code is written by outside
developers... Is there other way to compile the code under solaris? or
that warning is solaris specific one and I should correct the code?
Thanks in advance.
2008/7/24 James Carlson <james.d.carlson at sun.com>:
> Alexander Bubnov writes:
>> #include<string>
>> template<typename _C> struct string_conv_impl;
>>
>> template<typename _D, typename _S>
>> inline std::basic_string<_D> string_conv(std::basic_string<_S> const& src)
>> {
>> return string_conv_impl<_D>::do_conv(src.c_str());
>> }
>>
>> int main(){}
>
> Looking at the output from "g++ -E cpp.cpp" should be useful here. It
> shows this mess:
>
> # 2 "cpp.cpp" 2
> template<typename 0x00000020> struct string_conv_impl;
>
> template<typename _D, typename 0x00000008>
> inline std::basic_string<_D> string_conv(std::basic_string<0x00000008>
> const& src)
>
> Looking back at the original source, it appears that the problem is
> that you're using identifiers that start with "_". The standard
> reserves identifiers such as those to the operating environment -- you
> can't use them in any portable application.
>
> In this case, <iso/ctype.h> defines _C and _S as part of the standard
> <sys/ctype.h> mechanism.
>
> Fixing that bug produces a program fragment that compiles just fine on
> both Linux and OpenSolaris.
>
> #include<string>
> template<typename C> struct string_conv_impl;
>
> template<typename D, typename S>
> inline std::basic_string<D> string_conv(std::basic_string<S> const& src)
> {
> return string_conv_impl<D>::do_conv(src.c_str());
> }
>
> int main(){}
>
> --
> James Carlson, Solaris Networking <james.d.carlson at sun.com>
> Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084
> MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
>
--
/BR, Alexander