uninitialized local variable

Pages: 12
instead of reference in mpi_call.h I used pointer and it solved my problem, but i don't know why.
A reference has to be initialised - you can't have a reference to nothing. So if you had a reference that you weren't initialising in your default constructor, then you'd have a compiler error.

A pointer doesn't have to be initialised, so if youhave one that you fail to initialise, it won't cause a compiler error. Although you really should initialise it - having uninitialised pointers hanging around can make it really easy to introduce bugs into your code.

EDIT: In fact, nowhere in the code you've posted do you use the data member Vector. Nor, indeed, do you use the data members sendto or recieve. Why do you even have them? Why is MPI_CALL a class at all, when you don't use any of its data members?
Last edited on
@resabzr,
You don't need your own Vector class. A normal std::vector has a .data() member function which will give you direct access to the data buffer just like a normal array. So it can be used directly in MPI_Send and MPI_Recv calls like any simple array.

Hiding your MPI routines behind a separate MPI_CALL class is just going to make your code impossible to debug.
Topic archived. No new replies allowed.
Pages: 12