In a nutshell, the use of ellipses in functions like dolfin_error mean
that we cannot overload the function, e.g. it doesn't appear possible to
do:

  void dolfin_error(std::string location,
                    std::string task,
                    std::string reason, ...);

  void dolfin_error(MPI_Comm mpi_comm,
                    std::string location,
                    std::string task,
                    std::string reason, ...);


This works, what I'm missing?

-----------------------------
#include <string>
#include <iostream>
#include "mpi.h"

void dolfin_error(std::string location,
        std::string task,
        std::string reason, ...) {
        std::cout << "1" << std::endl;
};

void dolfin_error(MPI_Comm mpi_comm,
        std::string location,
        std::string task,
        std::string reason, ...) {
        std::cout << "2" << std::endl;
};
                

int main(void) {
        std::string a, b, c;
        int d = 1;
        dolfin_error(a, b, c);
        dolfin_error(a, b, c, d);
        dolfin_error(MPI_COMM_WORLD, a, b, c);
        dolfin_error(MPI_COMM_WORLD, a, b, c, d);

        return 0;
}
-----------------------------


Marco

_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to