[mpich-discuss] using mpi.h with C++ and warnings that result (ultra-pedantic)

Dmitri Gribenko gribozavr at gmail.com
Sat Mar 2 06:29:20 CST 2013


On Sat, Mar 2, 2013 at 6:51 AM, Dave Goodell <goodell at mcs.anl.gov> wrote:
> On Mar 1, 2013, at 9:57 PM CST, Jeff Hammond wrote:
>
>> I apologize in advance for being ultra-pedantic.
>>
>> I am using MPI in a purely C++ code.  Is there a way to make this
>> warning go away?  I know at least one MPICH developer who shares my
>> disdain for compiler warnings, so I hope this isn't too unreasonable.
>>
>> Since I am using a C++ compiler, I can't exactly tell it to use C99 mode.
>>
>> /Users/jhammond/eclipse/MPICH2/trunk/install-clang/include/mpi.h:526:9:
>> warning: 'long long' is an extension when C99 mode is not enabled
>> [-pedantic,-Wlong-long]
>> typedef long long MPI_Count;
>
> Don't compile with -pedantic.  It's almost never a useful flag.  Alternatively, add "-Wno-long-long" if you need other windmills to tilt at.

I would argue that -pedantic is, in fact, a useful flag.  For example,
LLVM and Clang are compiled with -pedantic, but we also add
-Wno-long-long (and a few other flags) to disable warnings about
extensions that are implemented virtually in every compiler.  And,
LLVM and Clang have *zero* warnings when compiled with itself.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the discuss mailing list