From: "Andrew Crabtree" Newsgroups: comp.os.msdos.djgpp Subject: Re: [Q]Computing speed in C++ Date: Thu, 5 Mar 1998 09:53:09 -0800 Organization: Hewlett Packard Lines: 30 Message-ID: <6dmoq7$8kn$1@rosenews.rose.hp.com> References: <34FCB769 DOT 42BEF1A8 AT gong DOT snu DOT ac DOT kr> <34FD3174 DOT 2401F904 AT gong DOT snu DOT ac DOT kr> <6dk947$kaf AT news-central DOT tiac DOT net> <34FE1383 DOT 9EFD3067 AT gong DOT snu DOT ac DOT kr> NNTP-Posting-Host: ros51675cra.rose.hp.com Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Bum-Seok Hyun wrote in message <34FE1383 DOT 9EFD3067 AT gong DOT snu DOT ac DOT kr>... >I didn't understand this result so I put a single line like >#if defined(__GNUG__) && defined(SLOWMODE) > printf("Is C++ alive??? \n"); // <- this single line >Then, when I compiled using gxx, it showed me that >C++ part in your source code wasn't used. Did you add a -DSLOWMODE to your command line? If you didn't do that then the code would be compiled? >And another thing is that I compiled C version using gxx, >the result is almost identical with using gcc. Of course it is. You need to understand that gcc and gxx are compiler drivers, not the actual compiler itself. You can use gcc to compile your c++ code and it will work. What happens is that both gcc and gxx look at the file extension to determine if code is c or c++, then the preprocessor is invoked, then either cc1 or cc1plus (depending on the extension), then the assembler, then the linker. >Anyway, from this ,now I understand variable declarations SHOULD >NOT BE PLACED in nested LOOPs if time is what I need. :-| Yep - Its a bad habit and should be avoided. Why stress out your optimizer if you can avoid it. Andy