c++ - Using directive still does not work?
- Wu Yongwei (6/6) Feb 28 2003 I see that with stlport now I can use "using std::cout;", "using std::en...
- Nic Tiger (9/15) Feb 28 2003 I had this problem too, but it went away when I downloaded and used the
- Hans Wennborg (4/35) Mar 01 2003 It would be great if this problem could be solved without having to use
- Wu Yongwei (4/7) Mar 02 2003 STLport could be used with other memory models. Try specifying
- Jim Jennings (12/18) Mar 03 2003 Are you sure about that? Check it out. I have version 8.32.17n, whic...
- Richard Grant (16/19) Mar 03 2003 Not that I'm defending Scott, but he concludes that there is no real bas...
- Jim Jennings (11/30) Mar 03 2003 He said that there is no reason to use it either -- since the standard c...
- Rajiv Bhagwat (23/59) Mar 04 2003 The way to specify command line defines is:
- Jim Jennings (14/20) Mar 04 2003 Rajiv,
- Walter (11/29) Mar 04 2003 news:b41qf3$2u16$1@digitaldaemon.com...
- Jim Jennings (3/24) Mar 04 2003 Pardon the rant. I learned something today. Thank you all very much.
-
Richard Grant
(9/10)
Mar 10 2003
#include
- Jim Jennings (10/20) Mar 12 2003 Richard,
- Richard Grant (3/6) Mar 13 2003 uh.. sorry. I mean the latest DM beta.
- Jim Jennings (10/17) Mar 13 2003 Richard,
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
Feb 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;", "usingstd::endl;",and such like. But "using namespace std;" still fails. I vaguelyremember ithas been a problem for quite some time. Anyone knows when this problemcould besolved? Best regards, Wu Yongwei
Feb 28 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;", "usingstd::endl;",and such like. But "using namespace std;" still fails. I vaguelyremember ithas been a problem for quite some time. Anyone knows when this problemcould besolved? Best regards, Wu Yongwei
Mar 01 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
Mar 02 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 YongweiAre 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
Mar 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.htmlNot 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) #else using std::endl; #endif Richard
Mar 03 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...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++".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.htmlNot 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) #else using std::endl; #endifPreprocessors, 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
Mar 03 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 messagenews:b3vuso$1pf6$1 digitaldaemon.com...little endl that couldn't" where he advised against theIn article <b3vrm9$1n7b$1 digitaldaemon.com>, Jim Jennings says...Scott Meyers wrote an article for C++ Report, December, 1995, "Thebasis togratuitous use of endl. You can find the article at: http://www.aristeia.com/publications_frames.htmlNot that I'm defending Scott, but he concludes that there is no realcalls for unbuffered cout, except that it is easier to typegenerally 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 standardthan '\n'. He is against endl because "it is one of my pet peeves". Butas 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++".review,The problem with std:endl and "using std::endl" is a bug that is underwhere theand while '\n' is a reasonable fix, it does not help in the instanceapplicator/manipulatorstream needs to be flushed. Any templatized use of thestd::endlpattern combined with the using declaration will fail. This includescan I) enter #define BROKEN_USING_DECLARATION from theand std::flush. In the rare instances that using std::endl appear, I tend to do: #if defined (BROKEN_USING_DECLARATION) #else using std::endl; #endifPreprocessors, and compiler flags are not my strong point. How do I (orcommand line? I have your "#if defined ...." in a test source file, andhave tried the flag:-D #define BROKEN_USING_DECLARATION with and without the parentheses when compiling. I get no complaint, butit doesn't take, either. I guess my question is: how do Iturn the define on for dmc, and off for another compiler? Edit the headerfile every time? I am using dmc almost exclusively now,but just in case. And where can one fine some examples of how the compilerflags work? I cannot figure them out.Jim J
Mar 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. - RajivRajiv, 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
Mar 04 2003
"Jim Jennings" <jwjenn mindspring.com> wrote in message news:b42jq2$ann$1 digitaldaemon.com..."Rajiv Bhagwat" <dataflow vsnl.com> wrote in messagenews:b41qf3$2u16$1 digitaldaemon.com...be spooked.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. - RajivRajiv, OK, it works. I would swear that I tried that, and it didn't work. I mustYes, it is in the documentation. But usually I have only a vague idea whatthe 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
Mar 04 2003
Pardon the rant. I learned something today. Thank you all very much. JIm "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. - RajivRajiv, 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
Mar 04 2003
In article <b415lj$2is1$1 digitaldaemon.com>, Jim Jennings says...I) enter #define BROKEN_USING_DECLARATION from the#include <iostream> using std::cout; using std::endl; int main() { cout << endl; } Works fine with latest beta.. Richard
Mar 10 2003
Richard, Just now saw your post. I downloaded STLport-4.5-0119. I do not see a makefile for Digital Mars, however. I have read the Install instructions quickly, and it seems complicated to me. Can you give me some instructions? Shall I query Christof? Or just wait until a set of DM instructions are published? I can survive the "endl" bug for awhile longer. Jim J. "Richard Grant" <fractal clark.net> wrote in message news:b4iprg$bg7$1 digitaldaemon.com...In article <b415lj$2is1$1 digitaldaemon.com>, Jim Jennings says...I) enter #define BROKEN_USING_DECLARATION from the#include <iostream> using std::cout; using std::endl; int main() { cout << endl; } Works fine with latest beta.. Richard
Mar 12 2003
In article <b4oog5$2p11$1 digitaldaemon.com>, Jim Jennings says...Richard, Just now saw your post. I downloaded STLport-4.5-0119. I do not see a makefile for Digital Mars,uh.. sorry. I mean the latest DM beta. Richard
Mar 13 2003
Richard, OK, I got the beta, and using std::endl; works. I had downloaded the zip some time ago, but did not know what to do with it. I did not realize that scppn.exe was the compiler. After your message, the dawn broke. I'm way down on the learning curve, but I really like the compiler. It is very fast, with smaller .exe files. Thanks very much for the tip. Jim "Richard Grant" <fractal clark.net> wrote in message news:b4pf8q$7if$1 digitaldaemon.com...In article <b4oog5$2p11$1 digitaldaemon.com>, Jim Jennings says...Richard, Just now saw your post. I downloaded STLport-4.5-0119. I do not see a makefile for Digital Mars,uh.. sorry. I mean the latest DM beta. Richard
Mar 13 2003