Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: An advice to all programmers:

Author: David Rasmussen

Date: 18:16:30 12/06/01

Go up one level in this thread


On December 06, 2001 at 13:31:44, Miguel A. Ballicora wrote:

>On December 06, 2001 at 12:53:14, Severi Salminen wrote:
>
>>Hi!
>>
>>Don't ever, I mean never ever, disable "those stupid warnings you don't want to
>>see anymore because they mean nothing". Well, for some odd reason I had disabled
>>unary operator and type conversion warnings. Now I just removed the #pragma
>>directive and found a major bug! I was using a 32-bit integer as a temporary
>>variable to store a 64-bit bitboard - how smart of me!! Actually I'm surprised I
>>hadn't noticed it before as it should've had corrupted the board representation
>>badly every time there was pawn double move. Well, now my program plays at least
>>5 elos better ;)
>>
>>Severi
>
>What I generally do is try to silence the warnings by rewriting my code
>as long as it is possible. Most of the time it is easy and it results in a
>safer, cleaner and more readable code (at least for me). When I can't, I include
>a local #pragma that I disable immediately after. Generally, I do not need this
>many times. Now, I have only one pragma valid for one line in my entire souce.
>I am pretty sure that I have more undetected bugs that pragmas :-)
>
>Miguel

I also try to fix all warnings, and also I try many different compilers, because
they find different things to warn about. Sometimes it is impossible, because
warnings conflict between compilers. Some compilers will warn that you have a
break after a return in a switch/case construct, "code can never be reached".
Others will warn that you don't have a break.




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.