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

Changing type of data_ to size_t to avoid compilation errors #4200

Merged
merged 6 commits into from
Oct 19, 2024

Conversation

vinayyadav3016
Copy link
Contributor

  1. If lib is cross-compiled for win32 using MXE environment it cause
    compilation error -Wconversion on line 730 as sizeof(unsigned long)
    = 4 and sizeof(size_t) = 8
  2. When lib is compiled on Unix like compiler generate error
    -Wuseless-cast if static_cast is used to fix issue in 1

when FMT_PEDANTIC && FMT_WERROR options are enabled
"""
error: useless cast to type 'class fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >' [-Werror=useless-cast]
 1449 |                      basic_format_args<buffer_context<char>>(args));
"""
cross compiling for win32 application using MXE environment because
long unsigned int != size_t (aka long long unsigned int)
1. If lib is cross-compiled for win32 using MXE environment it cause
   compilation error -Wconversion on line 730 as sizeof(unsigned long)
   = 4 and sizeof(size_t) = 8
2. When lib is compiled on Unix like compiler generate error
   -Wuseless-cast if static_cast is used to fix issue in 1

Futher if size_t is not concrete type then, type data_ can be changed to
uint64_t or uint32_t because those have same sizes across all platforms
@vitaut vitaut merged commit 58c185b into fmtlib:master Oct 19, 2024
44 of 45 checks passed
@vitaut
Copy link
Contributor

vitaut commented Oct 19, 2024

Thank you

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.

2 participants