Jump to page: 1 2
Thread overview
Using directive still does not work?
Feb 28, 2003
Wu Yongwei
Feb 28, 2003
Nic Tiger
Mar 01, 2003
Hans Wennborg
Mar 03, 2003
Wu Yongwei
Mar 03, 2003
Jim Jennings
Mar 03, 2003
Richard Grant
Mar 04, 2003
Jim Jennings
Mar 04, 2003
Rajiv Bhagwat
Mar 04, 2003
Jim Jennings
Mar 04, 2003
Walter
Mar 04, 2003
Jim Jennings
Mar 10, 2003
Richard Grant
Mar 13, 2003
Jim Jennings
Mar 13, 2003
Richard Grant
Mar 13, 2003
Jim Jennings
February 28, 2003
I see that with stlport now I can use "using std::cout;", "using std::endl;", and such like.  But "using namespace std;" still fails.  I vaguely remember it has been a problem for quite some time.  Anyone knows when this problem could be solved?

Best regards,

Wu Yongwei


February 28, 2003
I had this problem too, but it went away when I downloaded and used the
latest compiler beta.
Also I used the latest stlport.

Nic Tiger.

"Wu Yongwei" <adah@netstd.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:b3n7ck$2f45$1@digitaldaemon.com...
> I see that with stlport now I can use "using std::cout;", "using
std::endl;",
> and such like.  But "using namespace std;" still fails.  I vaguely
remember it
> has been a problem for quite some time.  Anyone knows when this problem
could be
> solved?
>
> Best regards,
>
> Wu Yongwei
>
>


March 01, 2003
It would be great if this problem could be solved without having to use the stlport, since it's only awailable for 32-bit compiling.


Hans

Nic Tiger wrote:
> I had this problem too, but it went away when I downloaded and used the
> latest compiler beta.
> Also I used the latest stlport.
> 
> Nic Tiger.
> 
> "Wu Yongwei" <adah@netstd.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
> news:b3n7ck$2f45$1@digitaldaemon.com...
> 
>>I see that with stlport now I can use "using std::cout;", "using
> 
> std::endl;",
> 
>>and such like.  But "using namespace std;" still fails.  I vaguely
> 
> remember it
> 
>>has been a problem for quite some time.  Anyone knows when this problem
> 
> could be
> 
>>solved?
>>
>>Best regards,
>>
>>Wu Yongwei
>>
>>
> 
> 
> 

March 03, 2003
STLport could be used with other memory models.  Try specifying "/D_STLP_NO_OWN_IOSTREAMS" on the command line.

Wu Yongwei

In article <b3qoop$26db$1@digitaldaemon.com>, Hans Wennborg says...
>
>It would be great if this problem could be solved without having to use the stlport, since it's only awailable for 32-bit compiling.
>
>
>Hans


March 03, 2003
"Wu Yongwei" <adah@netstd.com> wrote in message news:b3n7ck$2f45$1@digitaldaemon.com...
> I see that with stlport now I can use "using std::cout;", "using std::endl;", and such like.  But "using namespace std;" still fails.  I vaguely remember it has been a problem for quite some time.  Anyone knows when this problem could be solved?
>
> Best regards,
>
> Wu Yongwei
>
>

    Are you sure about that? Check it out. I have version 8.32.17n, which I downloaded on Feb. 20, 2003. I believe it is the latest
version.
    "using namespace std;" and "using std::cout" work, but "using std::endl;" does not. I.e., you can use it, but you will get a
compile error: "Error: template endl<> is not instantiated", unless you also say something like:

    cout << "Hello World" << std::endl;

but then it would be unnecessary to say "using std::endl;"  To save a lot of frustration use: '\n' unless you have a special reason
for using "endl".

    Scott Meyers wrote an article for C++ Report, December, 1995, "The little endl that couldn't" where he advised against the
gratuitous use of endl. You can find the article at:
    http://www.aristeia.com/publications_frames.html

Jim Jennings



March 03, 2003
In article <b3vrm9$1n7b$1@digitaldaemon.com>, Jim Jennings says...
>

>    Scott Meyers wrote an article for C++ Report, December, 1995, "The little endl that couldn't" where he advised against the
>gratuitous use of endl. You can find the article at:
>    http://www.aristeia.com/publications_frames.html

Not that I'm defending Scott, but he concludes that there is no real basis to
generally avoid using std::endl with the standard out streams
(w)cout/(w)cerr/(w)clog.

The problem with std:endl and "using std::endl" is a bug that is under review, and while '\n' is a reasonable fix, it does not help in the instance where the stream needs to be flushed. Any templatized use of the applicator/manipulator pattern combined with the using declaration will fail. This includes std::endl and std::flush.

In the rare instances that using std::endl appear, I tend to do:

#if defined (BROKEN_USING_DECLARATION)
# define endl std::endl
#else
using std::endl;
#endif

Richard


March 04, 2003
"Richard Grant" <fractal@clark.net> wrote in message news:b3vuso$1pf6$1@digitaldaemon.com...
> In article <b3vrm9$1n7b$1@digitaldaemon.com>, Jim Jennings says...
> >
>
> >    Scott Meyers wrote an article for C++ Report, December, 1995, "The little endl that couldn't" where he advised against the
> >gratuitous use of endl. You can find the article at:
> >    http://www.aristeia.com/publications_frames.html
>
> Not that I'm defending Scott, but he concludes that there is no real basis to
> generally avoid using std::endl with the standard out streams
> (w)cout/(w)cerr/(w)clog.

He said that there is no reason to use it either -- since the standard calls for unbuffered cout, except that it is easier to type
than '\n'.  He is against endl because "it is one of my pet peeves". But as you say there is no reason to avoid it anymore.
Providing compilers comply with standard. That's why he took it out of  "Effective C++".

>
> The problem with std:endl and "using std::endl" is a bug that is under review, and while '\n' is a reasonable fix, it does not help in the instance where the stream needs to be flushed. Any templatized use of the applicator/manipulator pattern combined with the using declaration will fail. This includes std::endl and std::flush.
>
> In the rare instances that using std::endl appear, I tend to do:
>
> #if defined (BROKEN_USING_DECLARATION)
> # define endl std::endl
> #else
> using std::endl;
> #endif
>
Preprocessors, and compiler flags are not my strong point. How do I (or can I) enter #define BROKEN_USING_DECLARATION from the
command line? I have your "#if defined ...."  in a test source file, and have tried the flag:
       -D #define BROKEN_USING_DECLARATION
with and without the parentheses when compiling. I get no complaint, but it doesn't take, either. I guess my question is: how do I
turn the define on for dmc, and off for another compiler? Edit the header file every time? I am using dmc almost exclusively now,
but just in case. And where can one fine some examples of how the compiler flags work? I cannot figure them out.
Jim J




March 04, 2003
The way to specify command line defines is:
-DBROKEN_USING_DECLARATION
and if you need to specify a value, it is:
-DBROKEN_USING_DECLARATION=1

This should be there in the documentation, somewhere.
- Rajiv

"Jim Jennings" <jwjenn@mindspring.com> wrote in message news:b415lj$2is1$1@digitaldaemon.com...
>
> "Richard Grant" <fractal@clark.net> wrote in message
news:b3vuso$1pf6$1@digitaldaemon.com...
> > In article <b3vrm9$1n7b$1@digitaldaemon.com>, Jim Jennings says...
> > >
> >
> > >    Scott Meyers wrote an article for C++ Report, December, 1995, "The
little endl that couldn't" where he advised against the
> > >gratuitous use of endl. You can find the article at:
> > >    http://www.aristeia.com/publications_frames.html
> >
> > Not that I'm defending Scott, but he concludes that there is no real
basis to
> > generally avoid using std::endl with the standard out streams
> > (w)cout/(w)cerr/(w)clog.
>
> He said that there is no reason to use it either -- since the standard
calls for unbuffered cout, except that it is easier to type
> than '\n'.  He is against endl because "it is one of my pet peeves". But
as you say there is no reason to avoid it anymore.
> Providing compilers comply with standard. That's why he took it out of
"Effective C++".
>
> >
> > The problem with std:endl and "using std::endl" is a bug that is under
review,
> > and while '\n' is a reasonable fix, it does not help in the instance
where the
> > stream needs to be flushed. Any templatized use of the
applicator/manipulator
> > pattern combined with the using declaration will fail. This includes
std::endl
> > and std::flush.
> >
> > In the rare instances that using std::endl appear, I tend to do:
> >
> > #if defined (BROKEN_USING_DECLARATION)
> > # define endl std::endl
> > #else
> > using std::endl;
> > #endif
> >
> Preprocessors, and compiler flags are not my strong point. How do I (or
can I) enter #define BROKEN_USING_DECLARATION from the
> command line? I have your "#if defined ...."  in a test source file, and
have tried the flag:
>        -D #define BROKEN_USING_DECLARATION
> with and without the parentheses when compiling. I get no complaint, but
it doesn't take, either. I guess my question is: how do I
> turn the define on for dmc, and off for another compiler? Edit the header
file every time? I am using dmc almost exclusively now,
> but just in case. And where can one fine some examples of how the compiler
flags work? I cannot figure them out.
> Jim J


March 04, 2003
"Rajiv Bhagwat" <dataflow@vsnl.com> wrote in message news:b41qf3$2u16$1@digitaldaemon.com...
> The way to specify command line defines is:
> -DBROKEN_USING_DECLARATION
> and if you need to specify a value, it is:
> -DBROKEN_USING_DECLARATION=1
>
> This should be there in the documentation, somewhere.
> - Rajiv

Rajiv,
OK, it works. I would swear that I tried that, and it didn't work. I must be spooked.
Yes, it is in the documentation. But usually I have only a vague idea what the exact form should be.
I.e.,   -Dmacro[=text]  what does that mean? Should I enter:
        -Dmacro[=BROKEN_USING_DECLARATION] ?  I know that is wrong.
       -D[BROKEN_USING_DECLARATION] ?  well, I know what [ . . . ] means.
       -D=BROKEN_USING_DECLARATION ?
       -D=#define BROKEN_USING_DECLARATION ?
        -DBROKEN_USING_DECLARATION =true (or on, yes, uh-huh!)
        -DDominus vobiscum.
And I can think of several more permutations and combinations (but never the right one)  Is the first commandment
of Unix documentation "Thou shalt never give an example!"? I hate to keep asking these neophyte questions.
Jim J



March 04, 2003
"Jim Jennings" <jwjenn@mindspring.com> wrote in message news:b42jq2$ann$1@digitaldaemon.com...
> "Rajiv Bhagwat" <dataflow@vsnl.com> wrote in message
news:b41qf3$2u16$1@digitaldaemon.com...
> > The way to specify command line defines is:
> > -DBROKEN_USING_DECLARATION
> > and if you need to specify a value, it is:
> > -DBROKEN_USING_DECLARATION=1
> >
> > This should be there in the documentation, somewhere.
> > - Rajiv
>
> Rajiv,
> OK, it works. I would swear that I tried that, and it didn't work. I must
be spooked.
> Yes, it is in the documentation. But usually I have only a vague idea what
the exact form should be.
> I.e.,   -Dmacro[=text]  what does that mean? Should I enter:
>         -Dmacro[=BROKEN_USING_DECLARATION] ?  I know that is wrong.
>        -D[BROKEN_USING_DECLARATION] ?  well, I know what [ . . . ] means.
>        -D=BROKEN_USING_DECLARATION ?
>        -D=#define BROKEN_USING_DECLARATION ?
>         -DBROKEN_USING_DECLARATION =true (or on, yes, uh-huh!)
>         -DDominus vobiscum.

-D means:
    #define DEBUG 1
-Dmacro means:
    #define macro 1
-Dmacro=text means:
    #define macro text


« First   ‹ Prev
1 2