Skip to content

compiler printf format warning doesn't really need to happen #136562

Open
@d3x0r

Description

@d3x0r

Compiled as C++...

   uintptr psvNew = 0;
   printf( "Socket is not a server socket %p", psvNew );
 warning: format ‘%p’ expects argument of type ‘void*’, but argument 2 has type ‘uintptr_t {aka long unsigned int}’ [-Wformat=]
   printf( "Socket is not a server socket %p", psvNew );

This should never actually be an issue. [u]intptr is defined as a integer type large enough to hold a pointer. It should always take the same amount of space as a pointer, and a pointer can round-trip to and from the type without issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions