Author: John Merlino
Date: 18:58:38 11/28/01
Go up one level in this thread
On November 27, 2001 at 19:53:01, Miguel A. Ballicora wrote: >On November 27, 2001 at 16:39:09, Dann Corbit wrote: > >>On November 27, 2001 at 16:12:24, Miguel A. Ballicora wrote: >> >>>Has anybody experienced bugs from MS Visual C 6.0 when programming in C? >>>A couple of times I have observed weird behaviors that after a lot of debugging >>>I had to conclude that there was something weird with the compiler or optimizer. >>>For instance, I include a printf() to debug part of the program and that was >>>never printed. It just skipped that instruction. I had no idea what it was >>>because I just rewrote the function to make it work. Most of the time I think >>>that I am wrong (most of the time I am wrong) but there are some things that do >>>not make sense. Now I am facing a problem that probably is me, but it look very >>>suspicious. I'll comment on that when I am sure I spent enough time on it. >>>I know that the probability to find bugs on the compiler or the libraries is not >>>zero. Some time ago I found something like this in one of the header files >>>provided with the libraries (I think it was time.h) >>> >>>#define SOMETHING CONSTANT+4 >>> >>>when it should be >>> >>>#define SOMETHING (CONSTANT+4) >>> >>>Forgetting the () is really bad. I was hunting ghosts for while until I decided >>>that there was nothing wrong with my code. >>> >>>Does anybody experience weird behaviors from this compiler? >>>I know that I have improve my "C", I just want to know whether I am crazy >>>or not :-) >> >>Every compiler has bugs. MS VC++ is actually a lot better than most of them. >>As you mention, the above is a very serious error. Was it in a standard header? > >I found it. Yes, it was in <stdio.h>, here it is, you can check it in your >own files: > >/* L_tmpnam = size of P_tmpdir > * + 1 (in case P_tmpdir does not end in "/") > * + 12 (for the filename string) > * + 1 (for the null terminator) > */ >#define L_tmpnam sizeof(_P_tmpdir)+12 > >Ugly, isn'it? Yes, it is. Actually, one of my favorite things to do to my boss when I was debugging with him was ask him if any macros were involved (particularly, any that he had written), because on more than one occasion he forgot to enclose the whole macro in parens, causing the bug. And, yes, this should definitely be reported. It is still in MSVC6 with all of the latest service packs. However, I think MSVC, in general, is a very good compiler in terms of a minimum of bugs. jm
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.