IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 20 years ago

Closed 17 years ago

#689 closed defect (fixed)

Add some type-checking routines to psLib etc.

Reported by: rhl@… Owned by: Paul Price
Priority: high Milestone:
Component: IPP SDRS Version: unspecified
Severity: normal Keywords:
Cc:

Description

The PS memory system allows us to check the type of a pointer (via the freeFunction in
the psMemBlock). I propose that we add a new API

bool psTypeEqual(void *ptr1, void *ptr2);

that would return false iff ptr1 and ptr2 were both non-NULL, and their freeFunctions
were different.

Note that this implies that we provide a (possibly trivial) freeFunction for _all_ types;
but this is needed for the proposal of PR 690

Change History (2)

comment:1 by Paul Price, 20 years ago

Owner: changed from eugene to Paul Price

Something like this is already in the SDRS (see 2.3.13, "Type checking"), and I
believe it is implemented in the code as well. What isn't in the code is the
use of this type checking e.g., when passing an array that a function expects
contains pointers to a particular type.

Does this functionality meet your requirements? I guess it wouldn't hurt to add
a "compare the free functions" function as well, to cover types that aren't
defined by psLib.

comment:2 by eugene, 17 years ago

Resolution: fixed
Status: newclosed

the functions that paul describes above can be used only if the user knows in advance what the type is. the comparison function proposed by robert could be used despite not knowing this info. I've implemented such a function and added it to the SDRS.

Note: See TracTickets for help on using tickets.