MPS issue job003323

TitleVarargs interfaces are hard to use
Statusclosed
Priorityoptional
Assigned userRichard Brooksby
OrganizationRavenbrook
DescriptionThe MPS uses varargs interfaces in four places:

mps_alloc
mps_ap_create
mps_arena_create
mps_pool_create

These interfaces are error-prone to use because the compiler cannot generate warnings or errors if you pass the wrong arguments, and you cannot look in the header file to find out the arguments. See for example [1], where I wrote:

"But how do I create a debug pool? When I do so I get this:

MPS ASSERTION FAILURE: SigCheck Format: format
../../mps-kit-1.110.0/code/format.c
21

Clearly I am missing some parameter to mps_pool_create, but this is a varargs function, and the debug pools are not documented in the reference manual."
Analysis1. Provide pool-specific versions of mps_alloc and mps_ap_create where these functions require extra arguments (as with mps_ap_create in AWL and SNC).

2. Provide arena-class-specific versions of mps_arena_create and pool-class-specific versions of mps_pool_create.

3. Deprecate the varargs versions of these functions.

When we carry out step (2) we might want to make the argument order for mps_arena_create_cl() for match that of mps_arena_extend(): that is, base followed by size. (Currently mps_arena_create for this class takes size followed by base: see ClientArenaInit in arenacl.c.)
How foundmanual_test
Evidence[1] <https://info.ravenbrook.com/mail/2012/09/28/17-12-07/0/>
Observed in1.110.0
Created byGareth Rees
Created on2012-10-18 16:43:44
Last modified byGareth Rees
Last modified on2013-05-25 18:24:33
History2012-10-18 GDR Created.

Fixes

Change Effect Date User Description
181994 closed 2013-05-20 13:58:25 Richard Brooksby Merging branch/2013-05-01/keyword-arguments back to master.