Skip to content

Resolve warning in ptr macros with pointer to integer cast#284

Merged
brarcher merged 1 commit into
masterfrom
ptr_macros_warning
Jun 29, 2020
Merged

Resolve warning in ptr macros with pointer to integer cast#284
brarcher merged 1 commit into
masterfrom
ptr_macros_warning

Conversation

@brarcher

Copy link
Copy Markdown
Contributor

A warning from pointer-to-int-cast is being thrown due to the
_ck_assert_ptr and _ck_assert_ptr_null macros casting a pointer
to an integer value (for printing), but the pointer and integer
sizes are different.

This commit first casts the pointer to a uintptr_t value before
casting it to an unsigned long.

This is the change referenced in #280 and attributed to vtorri.

A warning from pointer-to-int-cast is being thrown due to the
_ck_assert_ptr and _ck_assert_ptr_null macros casting a pointer
to an integer value (for printing), but the pointer and integer
sizes are different.

This commit first casts the pointer to a uintptr_t value before
casting it to an unsigned long.
@brarcher brarcher force-pushed the ptr_macros_warning branch from 83ff629 to 8c6788e Compare June 28, 2020 23:21
@brarcher brarcher merged commit aa2c55c into master Jun 29, 2020
@brarcher brarcher deleted the ptr_macros_warning branch June 30, 2020 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant