Skip to content

use std namespace for int types under cstdint#536

Open
UnixY2K wants to merge 1 commit intoSRombauts:masterfrom
UnixY2K:cstdint-fix
Open

use std namespace for int types under cstdint#536
UnixY2K wants to merge 1 commit intoSRombauts:masterfrom
UnixY2K:cstdint-fix

Conversation

@UnixY2K
Copy link
Copy Markdown
Contributor

@UnixY2K UnixY2K commented Mar 14, 2026

integer types under cstdint are only required to be under the std namespace while the global namespace definition is optional.

this PR fixes the undefined behavior for the files that assume global namespace availability.

Copy link
Copy Markdown

@GuillaumeDua GuillaumeDua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thanks

@dvtate
Copy link
Copy Markdown

dvtate commented Mar 31, 2026

Maybe there's something I'm missing but if std::int32_t doesn't alias the same type as int32_t there's something seriously wrong with your compiler's copy of the standard library or you're doing something very sketchy ... either way, library maintainers shouldn't try to work around that IMO.

@GuillaumeDua
Copy link
Copy Markdown

@dvtate I can't see anything exotic about the toolchain. Clang-21 with libstdc++.

Already saw such an issue in the past on other projects over the last perhaps 10+ years,
the reliable solution was always to use #include <cstdint> and std::int32_t.

But yeah, this is frustrating to not pin-point the root cause.

@dvtate
Copy link
Copy Markdown

dvtate commented Apr 1, 2026

I'm not seeing that in clang 21 (or any compiler for that matter).

Please find a compiler where this doesn't compile: https://godbolt.org/z/4GvEqbGze (for older compilers you may need --std=c++11 ).

According to chatgpt the only time that they wouldn't be the same is if that platform doesn't have a 32 bit integer type (unrealistic), in which case std::int32_t wouldn't exist and you'd get a compiler error if you tried to use it.

@GuillaumeDua
Copy link
Copy Markdown

@dvtate Did you try with the information provided in the issue ? #535 (comment)

Sadly, I don't have time for futher investigation.
So if you want to downvote or block this PR, then the choice is yours.

As mentioned, it's already fixed in 3.3.3 anyway.

@SRombauts SRombauts self-assigned this Apr 2, 2026
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.

4 participants