Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Slightly OT: Visual C++ 2005 Express Questions

Author: Omid David Tabibi

Date: 19:00:20 09/22/04

Go up one level in this thread


On September 22, 2004 at 21:13:11, Robert Hyatt wrote:

>On September 22, 2004 at 15:27:52, Omid David Tabibi wrote:
>
>>On September 22, 2004 at 11:49:57, Omid David Tabibi wrote:
>>
>>>On September 22, 2004 at 10:55:42, Robert Hyatt wrote:
>>>
>>>>On September 22, 2004 at 07:53:03, Omid David Tabibi wrote:
>>>>
>>>>>On September 22, 2004 at 01:36:40, Eugene Nalimov wrote:
>>>>>
>>>>>>On September 21, 2004 at 17:35:48, Omid David Tabibi wrote:
>>>>>>
>>>>>>>On September 21, 2004 at 11:54:25, Eugene Nalimov wrote:
>>>>>>>
>>>>>>>>On September 21, 2004 at 04:26:22, GeoffW wrote:
>>>>>>>>
>>>>>>>>>Hi
>>>>>>>>>
>>>>>>>>>I thought I would download the new : Visual C++ 2005 Express Edition beta to
>>>>>>>>>have a tinker with. It is proving trickier than expected to get my chess program
>>>>>>>>>to compile and run. Any help and tips would be appreciated please
>>>>>>>>>
>>>>>>>>>Q1
>>>>>>>>>This is not a stopper but would like an explanation
>>>>>>>>>
>>>>>>>>>warning C4996: 'sprintf' was declared deprecated
>>>>>>>>>        D:\Program Files\Microsoft Visual Studio 8\VC\include\stdio.h(285) : see
>>>>>>>>>declaration of 'sprintf'
>>>>>>>>>
>>>>>>>>>I am getting this deprecated warning on lots of standard C function calls ? How
>>>>>>>>>can a standard C function be possibly not supported in the future ?
>>>>>>>>>Unless I am misunderstanding the meaning of deprecated ?
>>>>>>>>
>>>>>>>>sprintf() is unsafe due to at least 2 reasons:
>>>>>>>>* possible buffer overrun,
>>>>>>>>* there is no runtime arguments type checks.
>>>>>>>>
>>>>>>>>I doubt it ever will be eliminated as it is part of the standard, but it's
>>>>>>>>possible that in the future you'll have to use special compiler command-line
>>>>>>>>option to be able to use it. E.g. something like -Unsecure.
>>>>>>>>
>>>>>>>>We are shipping Secure C Run-Time library as part of VS 2005.
>>>>>>>
>>>>>>>What about the "programmer always knows what he is doing" philosophy of C? Using
>>>>>>>an "-Unsecure" flag to compile C is kind of funny, as the whole C language is
>>>>>>>"unsecure"...
>>>>>>
>>>>>>So you think C compiler should never emit warnings? After all, "programmer
>>>>>>always knows what he is doing", so compiler should just silently compile the
>>>>>>source, right?
>>>>>
>>>>>Giving warnings is all right. Quite to the contrary in fact, I believe the more
>>>>>the warnings, the better. My problem is not with the warnings, but with the
>>>>>"-Unsecure" flag. I don't think it is logical that a correctly written C code
>>>>>would not compile, unless some irregular compiler flag is used. It makes more
>>>>>sense to have a "-Secure" flag, for people who would like to consider those
>>>>>warnings as errors.
>>>>>
>>>>
>>>>
>>>>I'd stick with Eugene here.  I'd rather get flagged for something that looks
>>>>suspicious, and have to take explicit action to get away with it, rather than to
>>>>accept known problematic code unless the user is sophisticated enough to specify
>>>>that such code should produce a diagnostic.  The inexperienced programmer needs
>>>>all the help he can get.  The experienced programmer will already be playing
>>>>with compiler options for optimization tricks...
>>>
>>>A code that complies with ANSI C should compile with default compiler options.
>>>The warnings should be put in form of warnings, not errors.
>>
>>As an example, a few months ago when I compiled my program with gcc on Linux, I
>>got the unsafe warning regarding "gets". It was nice to know that this function
>>is unsafe, and I wish MSVC would have generated similar warning. However, I
>>didn't have time to investigate the function at the time (being sure that I used
>>it correctly). A few days later, I studied gets in more detail and found that in
>>some parts of my program replacing it with fgets would be better.
>>
>>However, had I seen that the compiler refused to compile my original code
>>because of an "unsafe" gets, I would be wondering what the hell is wrong with
>>this compiler that cannot compile a code perfectly complying with ANSI/ISO C.
>>
>
>Think about this:  If all compilers made such things errors rather than warnings
>or ignoring them completely, we'd have far fewer security problems with buffer
>overflows and the like...

If these things are that bad, through them out of the ANSI standards of C
altogether. A compiler claiming to comply with ANSI C must be able to compile an
ANSI C conformant code with its default options.

People use C because it is the language closest to Assembly, which gives them
the highest control over the code. If the goal is to use a more "managed"
language and reduce the risks of such a high control, then I would suggest
avoiding C altogether and resorting to Java or C#.


>
>If something is bad, it really should be eliminated, not just "warned away".
>Human nature is to ignore warnings...

I'm not sure about that. I personally always try to produce a "0 warnings" code.
Wherever the compiler issues a warning, I examine the code and either change it,
or add a #pragma to disable the warning if I am sure about what I am doing.


>
>
>>
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>>>
>>>>>>
>>>>>>Thanks,
>>>>>>Eugene
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>>>Q2
>>>>>>>>>After having got it to build with some warnings but no errors I hit F5 to run
>>>>>>>>>but it comes up with the following error
>>>>>>>>>"The application failed to start because the Application configuration is
>>>>>>>>>incorrect. Reinstalling the Application may fix this problem ?"
>>>>>>>>>
>>>>>>>>>Is it telling me to install my program again, surely it is not telling me to
>>>>>>>>>reinstall Visual Studio again ? It doesnt give me any furher clues as to what
>>>>>>>>>the configuration problem might be. I did wonder if having an older version of
>>>>>>>>>VS on this PC might be screwing it up in some way ?
>>>>>>>>
>>>>>>>>Please verify that msvcr80.dll was copied into \windows\system32 directory.
>>>>>>>>Otherwise I have no ideas, as I am not a "setup person". You can ask a question
>>>>>>>>or report a bug at http://lab.msdn.microsoft.com/vs2005/.
>>>>>>>>
>>>>>>>>Thanks,
>>>>>>>>Eugene
>>>>>>>>
>>>>>>>>>Thanks for any ideas
>>>>>>>>>
>>>>>>>>>        Regards Geoff



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.