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

timg.cc: define __STDC_FORMAT_MACROS if undefined #143

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

barracuda156
Copy link
Contributor

Change of the header to <cinttypes> fixes the build with GCC, but some older clangs (and possibly other compilers) need __STDC_FORMAT_MACROS even then, so just define it to be on the safe side.

@hzeller
Copy link
Owner

hzeller commented Jan 3, 2025

This does look like a somewhat old requirement, removed in around 2013 https://sourceware.org/git/?p=glibc.git;a=commit;h=1ef74943ce2f114c78b215af57c2ccc72ccdb0b7

Can you add a comment saying with which compiler version you encountered an issue ? This makes it easier to keep track of and possibly decide when to remove the workaround in the future.

@barracuda156
Copy link
Contributor Author

barracuda156 commented Jan 3, 2025

@hzeller The issue is conditional on the OS, not only compiler. I use gcc14 now, but I know that the issue has been observed with clangs on older macOS version as well.
It appears from C++ online documentation that the issue may affect some other systems (it is not exclusive to macOS, otherwise that would probably be mentioned), but I only use macOS.

P. S. gcc does not need this macro when C++ header cinttypes is used. But needs with the C header.

@hzeller hzeller merged commit dbe0299 into hzeller:main Jan 3, 2025
@barracuda156 barracuda156 deleted the inttypes branch January 3, 2025 10:13
@barracuda156
Copy link
Contributor Author

@hzeller Thanks for merging!

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