1
1

An optimization/improvement from our old way of providing

MPI::SEEK_SET and friends, suggested by Doug Gregor.  This way allows
users to utilize SEEK_SET in a case statement, which they could not do
with our previous method.

This commit was SVN r19494.
Этот коммит содержится в:
Jeff Squyres 2008-09-04 15:02:52 +00:00
родитель 21910d29ff
Коммит 46da10ff08
2 изменённых файлов: 9 добавлений и 16 удалений

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

@ -18,14 +18,10 @@
//
// $HEADER$
#include <stdio.h>
static const int ompi_stdio_seek_set = SEEK_SET;
static const int ompi_stdio_seek_cur = SEEK_CUR;
static const int ompi_stdio_seek_end = SEEK_END;
#include "mpicxx.h"
/* Need to include ompi_config.h after mpicxx.h... */
/* Need to include ompi_config.h after mpicxx.h so that we get
SEEK_SET and friends right */
#include "ompi_config.h"
#if OMPI_CXX_USE_PRAGMA_IDENT
@ -39,13 +35,6 @@ namespace MPI {
#include "ompi/errhandler/errhandler.h"
#if OMPI_PROVIDE_MPI_FILE_INTERFACE && OMPI_WANT_MPI_CXX_SEEK
const int SEEK_SET = ompi_stdio_seek_set;
const int SEEK_CUR = ompi_stdio_seek_cur;
const int SEEK_END = ompi_stdio_seek_end;
#endif
namespace MPI {
#if ! OMPI_HAVE_CXX_EXCEPTION_SUPPORT

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

@ -49,6 +49,10 @@
// a #define (it's used in an enum).
#include <iostream>
static const int ompi_stdio_seek_set = SEEK_SET;
static const int ompi_stdio_seek_cur = SEEK_CUR;
static const int ompi_stdio_seek_end = SEEK_END;
// smash SEEK_* #defines
#ifdef SEEK_SET
#undef SEEK_SET
@ -57,9 +61,9 @@
#endif
// make globally scoped constants to replace smashed #defines
extern const int SEEK_SET;
extern const int SEEK_CUR;
extern const int SEEK_END;
static const int SEEK_SET = ompi_stdio_seek_set;
static const int SEEK_CUR = ompi_stdio_seek_cur;
static const int SEEK_END = ompi_stdio_seek_end;
#endif
// forward declare so that we can still do inlining