Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #85849 > unrolled thread
| Started by | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| First post | 2022-08-11 08:17 +0000 |
| Last post | 2022-08-11 20:14 +0000 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.c++
Curious phenomenon about the std::prefix and integer aliases Juha Nieminen <nospam@thanks.invalid> - 2022-08-11 08:17 +0000
Re: Curious phenomenon about the std::prefix and integer aliases Gawr Gura <gawrgura@mail.hololive.com> - 2022-08-11 02:19 -0700
Re: Curious phenomenon about the std::prefix and integer aliases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-08-11 16:28 +0100
Re: Curious phenomenon about the std::prefix and integer aliases Juha Nieminen <nospam@thanks.invalid> - 2022-08-11 20:14 +0000
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Date | 2022-08-11 08:17 +0000 |
| Subject | Curious phenomenon about the std::prefix and integer aliases |
| Message-ID | <td2dvi$g4u$1@gioia.aioe.org> |
I have noticed quite many times a rather curious phenomenon when it comes to using the 'std::' prefix and the type aliases in <cstdint>: There's a lot of C++ programmers who will use the 'std::' prefix for all standard library names (including those that come from the C standard library)... except for the type aliases in <cstdint>, such as int32_t, uint64_t, size_t, etc. They do this extremely consistently: The prefix with every other standard library name, never with the standard library integer type aliases. This phenomenon seems to be strangely common. I wonder why. (AFAIK the standard does not guarantee that the unprefixed names will work unless you #include <stdint.h>. They never do that, however. And even those who do... well, I still can't really comprehend why they meticulously use the prefix with everything except those type aliases.)
[toc] | [next] | [standalone]
| From | Gawr Gura <gawrgura@mail.hololive.com> |
|---|---|
| Date | 2022-08-11 02:19 -0700 |
| Message-ID | <td2hj5$24rac$1@dont-email.me> |
| In reply to | #85849 |
On 8/11/22 01:17, Juha Nieminen wrote: > I have noticed quite many times a rather curious phenomenon when it > comes to using the 'std::' prefix and the type aliases in <cstdint>: > > There's a lot of C++ programmers who will use the 'std::' prefix > for all standard library names (including those that come from the > C standard library)... except for the type aliases in <cstdint>, > such as int32_t, uint64_t, size_t, etc. They do this extremely > consistently: The prefix with every other standard library name, > never with the standard library integer type aliases. > > This phenomenon seems to be strangely common. I wonder why. > > (AFAIK the standard does not guarantee that the unprefixed names > will work unless you #include <stdint.h>. They never do that, > however. And even those who do... well, I still can't really > comprehend why they meticulously use the prefix with everything > except those type aliases.) What's to wonder about? People write software based on their understanding of conventions and not a pedantic commitment to the wording of the standard. Apparently, unlike various other names found in the standard library, the standard integer types don't present enough surprises when used in this way for people to change what they're doing. Personally, I always use the qualified name (e.g., std::int32_t) or an alias. I'm partial to defining i8, i16, i32, i64, and so on. What's your preference?
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2022-08-11 16:28 +0100 |
| Message-ID | <878rnug5pw.fsf@bsb.me.uk> |
| In reply to | #85849 |
Juha Nieminen <nospam@thanks.invalid> writes: > I have noticed quite many times a rather curious phenomenon when it > comes to using the 'std::' prefix and the type aliases in <cstdint>: > > There's a lot of C++ programmers who will use the 'std::' prefix > for all standard library names (including those that come from the > C standard library)... except for the type aliases in <cstdint>, > such as int32_t, uint64_t, size_t, etc. They do this extremely > consistently: The prefix with every other standard library name, > never with the standard library integer type aliases. > > This phenomenon seems to be strangely common. I wonder why. Maybe they think of these types (or maybe they may want to suggest that these types) are more like the standard types int, long an so on? Maybe they are not sure that the C standard does not give permission for these names to be macros? (It doesn't.) -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Date | 2022-08-11 20:14 +0000 |
| Message-ID | <td3nup$1156$2@gioia.aioe.org> |
| In reply to | #85854 |
Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: > Maybe they think of these types (or maybe they may want to suggest that > these types) are more like the standard types int, long an so on? I myself got bitten by that... but in reverse. After all, wchar_t looks exactly like those other type aliases. Yet it's not.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web