↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com>
writes:
This program works, but what are these warnings all about? The program
compiles on g++ and bcc32 without complaint. From STL Tutorial and
Reference, Second Edition, Musser, Derge, Saini
ex02-08.cpp, pp. 29-30
// Demonstrating the generic find algorithm with a deque
#include <iostream>
#include <cassert>
#include <deque>
#include <algorithm> // For find
using namespace std;
template <typename Container>
Container make(const char s[])
{
return Container(&s[0], &s[strlen(s)]);
}
int main()
{
cout << "Demonstrating generic find algorithm with "
<< "a deque." << endl;
deque<char> deque1 =
make< deque<char> >("C++ is a better C");
// Search for the first occurrence of the letter e:
deque<char>::iterator
where = find(deque1.begin(), deque1.end(), 'e');
assert (*where == 'e' && *(where + 1) == 't');
cout << " --- Ok." << endl;
return 0;
}:
C:\dm\bin\sc -Ae -C -WA -S -5 -a8 -o ex02-08.exe
ex02-08.cpp -I\dm\stlport\stlport
ex02-08.cpp(27) : Warning 12: variable 'char ** __cur_node' used before set
ex02-08.cpp(27) : Warning 12: variable 'char ** __cur' used before set
ex02-08.cpp(27) : Warning 12: variable 'char ** __cur' used before set
link ex02-08,ex02-08,,user32+kernel32/noi;
↑ ↓ ← → "Matthew Wilson" <dmd synesis.com.au>
writes:
I've had some similar ones from STLPort. I think it's because some STLPort
functions throw as the last action within function bodies, so there's no
return statement.
Oh, no, sorry. That was my errors. Doesn't seem to be the explanation for
yours.
I'd like to put some effort into the STLPort, if no-one else is - if they
are then am more than happy to leave it - but time's not going to be
friendly for a while.
Is there someone that has taken the STLPort under their wing? (Is that
Christof?)
"Jim Jennings" <jwjenn mindspring.com> wrote in message
news:b72m69$1oin$1 digitaldaemon.com...
This program works, but what are these warnings all about? The program
compiles on g++ and bcc32 without complaint. From STL Tutorial and
Reference, Second Edition, Musser, Derge, Saini
ex02-08.cpp, pp. 29-30
// Demonstrating the generic find algorithm with a deque
#include <iostream>
#include <cassert>
#include <deque>
#include <algorithm> // For find
using namespace std;
template <typename Container>
Container make(const char s[])
{
return Container(&s[0], &s[strlen(s)]);
}
int main()
{
cout << "Demonstrating generic find algorithm with "
<< "a deque." << endl;
deque<char> deque1 =
make< deque<char> >("C++ is a better C");
// Search for the first occurrence of the letter e:
deque<char>::iterator
where = find(deque1.begin(), deque1.end(), 'e');
assert (*where == 'e' && *(where + 1) == 't');
cout << " --- Ok." << endl;
return 0;
}:
C:\dm\bin\sc -Ae -C -WA -S -5 -a8 -o ex02-08.exe
ex02-08.cpp -I\dm\stlport\stlport
ex02-08.cpp(27) : Warning 12: variable 'char ** __cur_node' used before
ex02-08.cpp(27) : Warning 12: variable 'char ** __cur' used before set
ex02-08.cpp(27) : Warning 12: variable 'char ** __cur' used before set
link ex02-08,ex02-08,,user32+kernel32/noi;
↑ ↓ ← → Richard Grant <fractal clark.net>
writes:
In article <b72obm$1ptq$1 digitaldaemon.com>, Matthew Wilson says...
I'd like to put some effort into the STLPort, if no-one else is - if they
are then am more than happy to leave it - but time's not going to be
friendly for a while.
Is there someone that has taken the STLPort under their wing? (Is that
Christof?)
While I can't speak for Christof, I can say that if I have serious problems with
stlport, Christof is the one I'm going to go begging to.
As for the warnings, I mentioned in a much earlier thread that these were
warnings that appeared whenever a release build was made using deque (and
possibly a few others). I also added that they were annoying, but probably
harmless since no one has tracked them down. Since the thread has appeared
again, they are no longer "harmless" as they are wasting time.. so:
void fn(int i) { }
int main() {
int i;
try {
} catch (...) {
fn(i);
}
}
// Warning 12: variable 'int i' used before set
This is a design point made in STL for efficiency. __cur_node is assigned inside
the try block, and exceptions can only be thrown after the assignment.
I don't know what Walter wants to do with this. Warnings are generated for
optimized builds, but not for non optimized builds.
Richard
↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com>
writes:
"Richard Grant" <fractal clark.net> wrote in message
news:b74gfm$2uo7$1 digitaldaemon.com...
In article <b72obm$1ptq$1 digitaldaemon.com>, Matthew Wilson says...
Since the thread has appeared
again, they are no longer "harmless" as they are wasting time.. so:
void fn(int i) { }
int main() {
int i;
try {
} catch (...) {
fn(i);
}
}
// Warning 12: variable 'int i' used before set
Richard
I discovered that the warning messages are caused by the space between
the -o flag and the output file name in the command line:
C:\dm\bin\sc -Ae -C -WA -S -5 -a8 -o ex02-08.exe
ex02-08.cpp -I\dm\stlport\stlport
Take out the space and the warnings go away.
I will not waste any more time of my time.
Jim J.
↑ ↓ ← → "Walter" <walter digitalmars.com>
writes:
"Jim Jennings" <jwjenn mindspring.com> wrote in message
news:b74u7v$5rk$1 digitaldaemon.com...
I discovered that the warning messages are caused by the space between
the -o flag and the output file name in the command line:
C:\dm\bin\sc -Ae -C -WA -S -5 -a8 -o ex02-08.exe
ex02-08.cpp -I\dm\stlport\stlport
Take out the space and the warnings go away.
I will not waste any more time of my time.
Jim J.
-o by itself means "optimize". -ofilename means write the output to
filename.
↑ ↓ ← → "Jim Jennings" <jwjenn mindspring.com>
writes:
"Walter" <walter digitalmars.com> wrote in message
news:b753dc$9bu$2 digitaldaemon.com...
"Jim Jennings" <jwjenn mindspring.com> wrote in message
news:b74u7v$5rk$1 digitaldaemon.com...
I discovered that the warning messages are caused by the space between
the -o flag and the output file name in the command line:
C:\dm\bin\sc -Ae -C -WA -S -5 -a8 -o ex02-08.exe
ex02-08.cpp -I\dm\stlport\stlport
Take out the space and the warnings go away.
I will not waste any more time of my time.
Jim J.
-o by itself means "optimize". -ofilename means write the output to
filename.
g++ has an option -o <file> "place output into file", (with space). That's
the way the makefile is written, -o $ -- with a space -- and it compiles
with g++. I think that -ofilename and -o optimizer flag (whatever they are)
is a very fine distinction. Probably not one person in a thousand coming
over from gcc would be diligent enough to catch the difference.
However, all this is beside the point. Digital Mars is now relegated to file
13. Apparently everyone is happy working around the bugs and gratuitous
warnings. So there is no point in posting them anymore.
↑ ↓ ← → "Walter" <walter digitalmars.com>
writes:
"Jim Jennings" <jwjenn mindspring.com> wrote in message
news:b758nl$cma$1 digitaldaemon.com...
I am using a makefile written for the GNU compiler, that I adapted for
g++ has an option -o <file> "place output into file", (with space). That's
the way the makefile is written, -o $ -- with a space -- and it compiles
with g++. I think that -ofilename and -o optimizer flag (whatever they
is a very fine distinction. Probably not one person in a thousand coming
over from gcc would be diligent enough to catch the difference.
However, all this is beside the point. Digital Mars is now relegated to
13. Apparently everyone is happy working around the bugs and gratuitous
warnings. So there is no point in posting them anymore.
If I changed the way the command line worked, it would break innumerable
existing makefiles. It's not really an option to do that. Every compiler has
odd command line syntax in one way or another, there's no standard, it's all
in what you're used to. The existing syntax was not really designed to be
that way, it is an accumulation of 20 years of adding features while
retaining backward compatibility.
In the unix world, it's convention to put a space between a switch and its
argument. In the DOS/Win32 world, the convention is to not have a space
between. Neither is wrong or right, it's just convention.
What I do with projects for multiple compilers is just go ahead and do a
unique makefile for each compiler.
↑ ↓
← → "Jim Jennings" <jwjenn mindspring.com>
writes:
"Richard Grant" <fractal clark.net> wrote in message
news:b74gfm$2uo7$1 digitaldaemon.com...
In article <b72obm$1ptq$1 digitaldaemon.com>, Matthew Wilson says...
again, they are no longer "harmless" as they are wasting time.. so:
void fn(int i) { }
int main() {
int i;
try {
} catch (...) {
fn(i);
}
}
// Warning 12: variable 'int i' used before set
This is a design point made in STL for efficiency. __cur_node is assigned
the try block, and exceptions can only be thrown after the assignment.
Richard
try/catch sequence in my source code to suppress a compiler warning? Or did
I overlook another smiley?
James