[cfe-dev] [libcxx] Why the type of (w)cin/(w)cout/(w)cout are char []?
Jonathan Roelofs via cfe-dev
cfe-dev at lists.llvm.org
Mon May 16 12:16:37 PDT 2016
On 5/16/16 12:12 PM, Yi-Hong Lyu via cfe-dev wrote:
> Hello all,
>
> I am porting libcxx to Windows (not mingw). I am curious about the
> design of (w)cin/(w)cout/(w)cout. Currently we define
> (w)cin/(w)cout/(w)cout as char[] under src/iostream.cpp and initialise
> them as istream/ostream in function ios_base::Init::Init(). Why don't we
> defined them as istream/ostream object directly?
I /think/ the reasoning behind this is to get tight control over their
initialization order.
Jon
> The drawback of current
> design in my mind is that cause linking error under Windows. Windows
> mangler takes data type into account. Reference of std::cin would be
> translated into
> ?cin at __1@std@@3V?$basic_istream at DU?$char_traits at D@__1 at std@@@12 at A (class
> std::__1::basic_istream<char,struct std::__1::char_traits<char> >
> std::__1::cin). Definition of std::cin, in contrast, would be translated
> into ?cin at __1@std@@3PADA (char * std::__1::cin). There is a linking
> error because two symbols are different.
>
> Any suggestion or comment is appreciated,
> Yi-Hong
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
--
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded
More information about the cfe-dev
mailing list