Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stb_ds: Make STBDS_OFFSETOF() return size_t #1665

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

czarnota
Copy link

Current implementation of STBDS_OFFSETOF() produces a warning when using shdel().

:error: implicit conversion changes signedness: 'long' to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
	if (!shdel(console->index_entries, entry->key))

This is observed on Apple clang version 15.0.0 (clang-1500.3.9.4).

This happens because the difference between pointers is ptrdiff_t not size_t. A cast to size_t fixes the problem.

Current implementation of STBDS_OFFSETOF() produces a warning when using
shdel().

	:error: implicit conversion changes signedness: 'long' to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
		if (!shdel(console->index_entries, entry->key))

This is observed on Apple clang version 15.0.0 (clang-1500.3.9.4).

This happens because the difference between pointers is ptrdiff_t not
size_t. A cast to size_t fixes the problem.
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