1
1

* need to include iostream as well as stdio.h when doing the tricks with

MPI::SEEK_* because iostreams (well, ios_base, but I don't think that
    should be included directly) can use SEEK_* as values in an enum, which
    means that 'const int' is bad for them.
  * Remove now useless comments in the cxx example programs
  * include iostream after mpi.h so that our examples work with other MPI
    implementations that don't try to be as friendly with the constants.

Refs trac:387

This commit was SVN r12125.

The following Trac tickets were found above:
  Ticket 387 --> https://svn.open-mpi.org/trac/ompi/ticket/387
Этот коммит содержится в:
Brian Barrett 2006-10-16 14:20:31 +00:00
родитель 9a8e3d2318
Коммит fdc8f69b84
3 изменённых файлов: 10 добавлений и 16 удалений

Просмотреть файл

@ -7,15 +7,8 @@
// Sample MPI "hello world" application in C++
//
// MPI's C++ bindings unfortunately redefined some POSIX constants
// (SEEK_SET and friends). Fortunately, most versions of <iostream>
// and <stdio.h> are sane enough that if you include "mpi.h" first,
// they won't redefine the problematic values. Note, however, that
// this means that you should not make calls to fseek(3) (and friends)
// in a C++ source file that includes <mpi.h>!
#include <iostream>
#include "mpi.h"
#include <iostream>
int main(int argc, char **argv)
{

Просмотреть файл

@ -7,15 +7,8 @@
// Simple ring test program
//
// MPI's C++ bindings unfortunately redefined some POSIX constants
// (SEEK_SET and friends). Fortunately, most versions of <iostream>
// and <stdio.h> are sane enough that if you include "mpi.h" first,
// they won't redefine the problematic values. Note, however, that
// this means that you should not make calls to fseek(3) (and friends)
// in a C++ source file that includes <mpi.h>!
#include <iostream>
#include "mpi.h"
#include <iostream>
int main(int argc, char *argv[])
{

Просмотреть файл

@ -37,8 +37,16 @@
#include <stdarg.h>
#if !defined(OMPI_IGNORE_CXX_SEEK) & OMPI_WANT_MPI_CXX_SEEK
// We need to include the header files that define SEEK_* or use them
// in ways that require them to be #defines so that if the user
// includes them later, the double inclusion logic in the headers will
// prevent trouble from occuring.
// include so that we can smash SEEK_* properly
#include <stdio.h>
// include because on Linux, there is one place that assumes SEEK_* is
// a #define (it's used in an enum).
#include <iostream>
// smash SEEK_* #defines
#ifdef SEEK_SET