Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: minimize warnings in Compiling Crafty on different kind of platforms

Author: Dave Gomboc

Date: 01:54:01 10/26/99

Go up one level in this thread


On October 25, 1999 at 10:46:39, Dann Corbit wrote:

>On October 24, 1999 at 17:16:18, Robert Hyatt wrote:
>[snip]
>>It is basically impossible to write a piece of code that is 100% warning-free
>>on all compilers.
>
>I try to get as clean a Lint as possible (using PC-Lint -- LCLint is useful for
>finding some things, but about 1/3 of its warnings are just plain stupid).  I
>also run the code through GCC at -Wall -ansi -pedantic as GCC has one of the
>best error checking fascilities around.
>
>It is clearly true that you can't satisfy all compiler warnings.  Sometimes the
>warning is wrong and shutting up the warning by doing what they suggest will
>break something!

What's a good way to shut off gcc/g++'s

blah.cpp:36: warning: aggregate has a partly bracketed initializer
blah.cpp:37: warning: aggregate has a partly bracketed initializer

?  These are being caused by using a block (q.v. Generic Programming and the
STL, Austern 1999).  Block is a STL container that is like a C array, so

block <int, 4> four_ints = {1, 2, 3, 4};

is the style I am looking for.  Of course, gcc wants

block <int, 4> four_ints = {{1, 2, 3, 4}};

because the data members are within the actual array owned by the block.

Is there a way to shut off the warning with some pragma for just those two
lines?  I'd settle for shutting off that particular warning for the entire
compile if I have to, though.

Dave



This page took 0.01 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.