|
From: Michal M. <mol...@se...> - 2002-12-12 01:55:52
|
On Thu, 12 Dec 2002 12:34:54 +1100 Dave Walters
<orb...@ne...> wrote:
> right... i found the typedef in
> $devcpp/include/g++-3/string :
>
> // Main header for the -*- C++ -*- string classes.
>
> #ifndef __STRING__
> #define __STRING__
>
> #include <std/bastring.h>
>
> extern "C++" {
> typedef basic_string <char> string;
> // typedef basic_string <wchar_t> wstring;
> } // extern "C++"
>
> #endif
>
>
> btw_____this matches exactly the file on my linux box (rh
> 7.1)_________/usr/include/g++-3/string :)
>
>
> why is it commented out?
>
> especially when there is an entry in the stdlib.ChangeLog stating that it
> has been UNcommented ...
in my dev-c++ 4.9.7.0 + gcc 3.2 it's already uncommented but somebody
forget
to recompile the library with it :-(
> so i uncommented it, and i tried this :
>
> #include <string>
> #include <iostream.h>
>
> void main (void) {
> std::wstring fish;
> fish = (wchar_t)"fish"; //i shouldn't have to typecast this should i
> cout << fish << endl;
> }
>
>
> and the output is "0", which makes me think i'm missing something with
> how
> wstrings are handled in the gnu std:: templates ...?
you probably wanted to write:
fish = (wchar_t * ) "fish";
weren't you?
but it still want be correct as the correct syntax is
fish = L"fish";
and it should be written to wcout instead of cout
p.s.
it's better to
#include <iostream>
using namespace std;
instead of
#include <iostream.h>
and btw C++ standard knows only main returning int (not void)
Thanks in advance,
Michal
|