Archives
D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger
C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows
digitalmars.empire
digitalmars.DMDScript
|
c++ - Using directive still does not work?
↑ ↓ ← → Wu Yongwei <adah netstd.com> writes:
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
↑ ↓ ← → "Nic Tiger" <nictiger progtech.ru> writes:
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
and such like. But "using namespace std;" still fails. I vaguely
has been a problem for quite some time. Anyone knows when this problem
solved?
Best regards,
Wu Yongwei
↑ ↓ ← → Hans Wennborg <hans hanshq.net> writes:
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
↑ ↓ ← → Wu Yongwei <adah netstd.com> writes:
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
↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com> writes:
"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
↑ ↓ ← → Richard Grant <fractal clark.net> writes:
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
↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com> writes:
"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
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
↑ ↓ ← → "Rajiv Bhagwat" <dataflow vsnl.com> writes:
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
In article <b3vrm9$1n7b$1 digitaldaemon.com>, Jim Jennings says...
Scott Meyers wrote an article for C++ Report, December, 1995, "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
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
than '\n'. He is against endl because "it is one of my pet peeves". But
Providing compilers comply with standard. That's why he took it out of
The problem with std:endl and "using std::endl" is a bug that is under
and while '\n' is a reasonable fix, it does not help in the instance
stream needs to be flushed. Any templatized use of the
pattern combined with the using declaration will fail. This includes
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
command line? I have your "#if defined ...." in a test source file, and
-D #define BROKEN_USING_DECLARATION
with and without the parentheses when compiling. I get no complaint, but
turn the define on for dmc, and off for another compiler? Edit the header
but just in case. And where can one fine some examples of how the compiler
Jim J
↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com> writes:
"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
↑ ↓ ← → "Walter" <walter digitalmars.com> writes:
"Jim Jennings" <jwjenn mindspring.com> wrote in message
news:b42jq2$ann$1 digitaldaemon.com...
"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
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
Yes, it is in the documentation. But usually I have only a vague idea what
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
↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com> writes:
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.
- 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
↑ ↓ ← → Richard Grant <fractal clark.net> writes:
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
↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com> writes:
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
↑ ↓ ← → Richard Grant <fractal clark.net> writes:
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
↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com> writes:
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
|
|