| Title | Unused closure arguments are unchecked |
| Status | closed |
| Priority | nice |
| Assigned user | Gareth Rees |
| Organization | Ravenbrook |
| Description | RB 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. |
| Analysis | Better 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 found | inspection |
| Evidence | [1] <https://info.ravenbrook.com/mail/2014/05/29/13-01-02/0/> |
| Created by | Gareth Rees |
| Created on | 2014-05-29 14:37:36 |
| Last modified by | Gareth Rees |
| Last modified on | 2014-05-29 15:28:33 |
| History | 2014-05-29 GDR Created. |
| 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. |