count variable

count variable

by Mojdeh Akhavan -
Number of replies: 2


I am trying to understand the behavior of firstmessage.c when I change the count variable in MPI_sSend and MPI_Recv commands. When I change it from 6 to 5 in MPI_Ssend (or in both Ssend and Recv), I get the following output:

1: Got message <Hello    Hello>
0: Sent message <Hello>

But if I make the same change for MPI_Recv, the result is:

1: Got message <>
0: Sent message <Hello>

Could you please explain it?

In reply to Mojdeh Akhavan

Re: count variable

by Bruno Mundim -
What you are seeing is language undefined behaviour, since you are trying
to print a C null-terminated string of character without the null character.
In other words you are not printing a C string and the behaviour is undefined
by the language standard. Some references on this topic: