Skip to content

possible misuse of std::string in the MPI_Bcast call in Broadcast.cpp. #336

@grnydawn

Description

@grnydawn

From reviewing the Omega source code, I noticed warnings about the misuse of std::string in the MPI_Bcast call in Broadcast.cpp. I am not 100% sure whether this is a real issue, but I thought it was worth bringing up here.

Currently, the Broadcast function for the std::string type contains the following line:

MPI_Bcast((void *)Value.c_str(), Value.size(), MPI_CHAR, Root, Comm);

I was advised to replace it with:

MPI_Bcast(&Value[0], Value.size(), MPI_CHAR, Root, Comm);

to prevent the potential issue that Value.c_str() returns a const char*.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions