mpi-forum / mpi-forum-historic

Migration of old MPI Forum Trac Tickets to GitHub. New issues belong on mpi-forum/mpi-issues.
http://www.mpi-forum.org
2 stars 3 forks source link

MPI_T: Maximum string length constants #469

Closed mpiforumbot closed 8 years ago

mpiforumbot commented 8 years ago

Originally by kathrynmohror on 2014-12-30 12:27:30 -0600


Currently, tools have call the info function for variables and catetories twice to make sure the name buffer is large enough to hold the full name. Suggest that we define additional constants, such as MPI_T_PVAR_MAX_NAME_LEN, which indicate the maximum length a pvar name (in this example) can have. Then a tools can choose to pay in time (with two calls) or memory (with always allocating max memory) for a pvar name buffer.

mpiforumbot commented 8 years ago

Originally by ftillier on 2015-01-23 12:04:09 -0600


A compile time constant does not support dynamic layering of libraries- you have to build specifically for the implementation and libraries (including version) you plan on using. Better would be to have a function to return the maximum, if it is known, or MPI_UNDEFINED if it is not, but I'm not sure that'd be that useful.

Is this really a problem, though? There is nothing that requires tools to make two calls each time they want to get a string - they can have a pre-allocated buffer of a pre-defined length that they expect will satisfy the majority of their calls. There are then a number of options to handle truncation: