Skip to content

Cast pointers to void pointer before printing with %p #378

@nirmal-mina

Description

@nirmal-mina

Summary

Fixes portability issues around %p formatting.

%p expects a void *. Passing other pointer types directly can trigger compiler warnings and is technically not portable.

Changes

  • 01/mem.c: cast pointer argument to (void *).
  • 06/va.c: cast object pointer argument to (void *).

Note

Function pointers are not strictly portable to print with %p; this PR keeps the example simple while reducing avoidable warnings where possible.

Testing

  • Compiled affected examples with warnings enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions