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

PIMeval & PIMbench: Improving Portablity of Print Statements #188

Open
fasiddique opened this issue Oct 16, 2024 · 0 comments
Open

PIMeval & PIMbench: Improving Portablity of Print Statements #188

fasiddique opened this issue Oct 16, 2024 · 0 comments
Assignees
Labels
cleanup code cleanup

Comments

@fasiddique
Copy link
Collaborator

fasiddique commented Oct 16, 2024

uint64_t types in PIMeval and PIMbench are currently being printed using format specifiers like %lld or %lu. While some compilers handle this without warnings, others produce warnings due to incorrect format specifiers for uint64_t. To ensure portability and avoid such warnings, the recommended approach is to use the <cinttypes> header and print using:

printf("%" PRIu64 "\n", value);

This ensures the code is portable across different platforms and compilers, which may have different representations for uint64_t.

Proposed Solution:

  • Replace all occurrences of %lld or %lu used for uint64_t with %" PRIu64 " as defined in <cinttypes>.
  • Ensure that <cinttypes> is included wherever uint64_t is printed.

Reference:

  1. https://en.cppreference.com/w/c/types/integer#Format_macro_constants
@fasiddique fasiddique self-assigned this Oct 16, 2024
@fasiddique fasiddique added the enhancement Incremental enhancement label Oct 16, 2024
@fasiddique fasiddique changed the title PIMeval PIMeval & PIMbench: Improving Portablity of Print Statements Oct 16, 2024
@fasiddique fasiddique added cleanup code cleanup and removed enhancement Incremental enhancement labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup code cleanup
Projects
None yet
Development

No branches or pull requests

1 participant