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

SCP: Reduce compiler warnings on LP64 platforms #332

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

bscottm
Copy link
Contributor

@bscottm bscottm commented Dec 21, 2023

(Note: Reducing compiler warnings across all, but primarily LP64 platforms, is a long term objective.)

Reduce compiler warnings on LP64 platforms (macOS, Windows) and 32-bit builds (Win32). Prefer 'size_t' for pointer arithmetic, array indexing and extents; 'int' hasn't been used for these purposes for many years and across many ANSI standards. N.B. that conversions from int or int32 to size_t cause the compiler to zero-extend the value, which is inefficient.

Refactor printf() format modifiers into sim_printf_fmts.h. Add the SIZE_T_FMT modifier for better portability, especially on LP64 platforms where size_t is unsigned long and sizeof(size_t) > sizeof(int).

3B2: Fix known size_t printf() format.

(Note: Reducing compiler warnings across all, but primarily LP64
platforms, is a long term objective.)

Reduce compiler warnings on LP64 platforms (macOS, Windows) and 32-bit
builds (Win32). Prefer 'size_t' for pointer arithmetic, array indexing
and extents; 'int' hasn't been used for these purposes for many years
and across many ANSI standards. N.B. that conversions from int or int32
to size_t cause the compiler to zero-extend the value, which is
inefficient.

Refactor printf() format modifiers into sim_printf_fmts.h. Add the
SIZE_T_FMT modifier for better portability, especially on LP64 platforms
where size_t is unsigned long and sizeof(size_t) > sizeof(int).

3B2: Fix known size_t printf() format.
@pkoning2 pkoning2 merged commit a275c71 into open-simh:master Feb 1, 2024
18 checks passed
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