Skip to content

RULE-11-3: Permit cast to pointer-to-void #317

Closed
@lcartey

Description

@lcartey

Affected rules

  • RULE-11-3
  • RULE-11-4
  • RULE-11-5
  • RULE-11-7

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.

Update: this has been determined to be a problem specifically with const void * and other specified void pointers.

Example

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

Metadata

Metadata

Assignees

Labels

Difficulty-LowA false positive or false negative report which is expected to take <1 day effort to addressImpact-Highfalse positive/false negativeAn issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding Standards

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions