MPS issue job003825

TitleUnused closure arguments are unchecked
Statusclosed
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionRB points out in review [1] that where closure arguments are unused, the code usually passes NULL and 0 for the pointer and size. But these are the most likely values to occur by accident.
AnalysisBetter to pass values that can't occur by accident, and then check them in the visitor or callback.

/* UNUSED_POINTER, UNUSED_SIZE -- values for unused arguments
 *
 * Use these values for unused pointer, size closure arguments and
 * check them in the callback or visitor.
 */
#define UNUSED_POINTER ((Pointer)0xB60405ED) /* PointeR UNUSED */
#define UNUSED_SIZE ((Size)0x520405ED) /* SiZe UNUSED */
How foundinspection
Evidence[1] <https://info.ravenbrook.com/mail/2014/05/29/13-01-02/0/>
Created byGareth Rees
Created on2014-05-29 14:37:36
Last modified byGareth Rees
Last modified on2014-05-29 15:28:33
History2014-05-29 GDR Created.

Fixes

Change Effect Date User Description
186352 closed 2014-05-29 15:28:33 Gareth Rees Pass and check special closure values UNUSED_POINTER, UNUSED_SIZE instead of NULL, 0.