How to use gdb to start a program in the middle of a C++ program?

2005-10-04 Thread pengyu...@gmail.com
Hi, Suppose it takes me a lot of time to reach the bug code. I don't want to run the program again and again. Is there any way to dump the internal information to the disk? And then load it when I need it? I heard it is possible. Would you help me? Best wishes, Peng

About -I option in g++?

2005-11-16 Thread pengyu...@gmail.com
Hi, I'm wondering whether g++ will search the dir (specified with -I option) recursively? I read the manual. The manual answer this question. Would you please tell me if you know it? Thanks, Peng ___ Help-gplusplus mailing list Help-gplusplus@gnu.org h

About -I option in g++?

2005-11-16 Thread pengyu...@gmail.com
Hi, I'm wondering whether g++ will search the dir (specified with -I option) recursively? I read the manual. The manual answer this question. Would you please tell me if you know it? Thanks, Peng ___ Help-gplusplus mailing list Help-gplusplus@gnu.org h

About g++ option -MM

2006-01-25 Thread pengyu...@gmail.com
Suppose I have a file "main.cc", if I run the following command "g++ -MM main.cc, I'll end up with following rule "main.o: main.cc". Is there anyway that "main-o.o: main.cc" can be generated with g++? Thanks, Peng ___ Help-gplusplus mailing list Help-g

Re: About g++ option -MM

2006-01-25 Thread pengyu...@gmail.com
Paul Pluzhnikov wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > Is there anyway that "main-o.o: main.cc" can be generated with g++? > > Sure: > > $ g++ -MM main.cc > main.o: main.cc > $ g++ -MM main.cc -MT main-o.o > main-o.o: main.cc The problem that I have actually is that, I wan

About g++ optimization

2006-03-30 Thread pengyu...@gmail.com
for(int i = 0; i < f(n); ++ i) { ... } If I have the above "for" statement and I compile it with -O3, will the function "f(n)" be optimized such that f(n) will only be evaluated once. Or I have to factor "f(n)" outside the loop to make sure that it only be evaluated once? Thanks, Peng __

Re: About g++ optimization

2006-03-30 Thread pengyu...@gmail.com
Allan Wind wrote: > On 2006-03-30T12:30:30-0800, [EMAIL PROTECTED] wrote: > > for(int i = 0; i < f(n); ++ i) { > > ... > > } > > Make sure you remove the space between ++ and i. Why I have to remove the space? Is it well accepted coding convention? > > > If I have the above "for" statement and I

How generate a warning when int is converted to bool or bool is converted to int?

2006-04-02 Thread pengyu...@gmail.com
I'm using g++-3.4. Is there any compiler flag I can specify to enable this kind of warning? "-Wall" can't give this kind of warning. ___ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus

Re: How generate a warning when int is converted to bool or bool is converted to int?

2006-04-06 Thread pengyu...@gmail.com
[EMAIL PROTECTED] wrote: > Try using the -pedantic flag. It issues all the warnings demanded by > strict ISO C and ISO C++, which should cover the type conversion Is it too restrictive? I only want the warning for bool <-> int conversion and do not want to turn off any other feature that g++ have

Re: How generate a warning when int is converted to bool or bool is converted to int?

2006-04-07 Thread pengyu...@gmail.com
[EMAIL PROTECTED] wrote: > Try using the -pedantic flag. It issues all the warnings demanded by > strict ISO C and ISO C++, which should cover the type conversion Actually this flag can not make g++ generate this kind of warning. Is there anybody know the correct flag. __

Where is the definitions of functions?

2007-09-26 Thread pengyu...@gmail.com
Hi, I'm wondering where the definitions of the functions in are in GCC. I can not find them in GCC source code. Could you help me? int i std::istream is; is >> i; // For example, I want the definition of this function (>>). Thanks, Peng ___ help-gpl

g++ optimization problem for branch statements conditioned with const bool

2007-10-07 Thread pengyu...@gmail.com
Hi, I have the following test program and compiled it with the -O3 in g++ (. In "one_branch()" function, the two loops run in the same among of the time, which means the if statement in the first loop is not tested. In "two_branches" function, the last loop runs a lot faster than the other three l