codeql-coding-standards icon indicating copy to clipboard operation
codeql-coding-standards copied to clipboard

`RULE-11-3`: Permit cast to pointer-to-void

Open lcartey opened this issue 1 year ago • 0 comments

Affected rules

  • RULE-11-3

Description

The rule states that "a cast shall not be performed between a pointer to object type and a pointer to a different object type". However, void isn't a different object type. Rule 11.5 handles pointer-to-void, prohibiting casting from pointer-to-void, but permitting casting to pointer-to-void.

Example

uint32_t *p32;
void *p;
p = p32; // Compliant

lcartey avatar Jun 28 '23 13:06 lcartey