Liste des Groupes | Revenir à cl c |
On 08/04/2025 15:57, David Brown wrote:On 08/04/2025 15:32, bart wrote:On 05/04/2025 18:56, Philipp Klaus Krause wrote:Am 02.04.25 um 11:57 schrieb bart:>* Where are the fixed-width types from stdint.h?>
Same as for size_t, etc: They don't exist. Those are not separate
types, just typedefs to some other types. E.g. uint16_t could be
typedef'ed to unsigned int.
This is the point I made a few weeks back, but others insisted
they were part of C:
>
>
Me:
>> stdint.h et al are just ungainly bolt-ons, not fully supported
by the >> language.
>
Keith Thompson:
> No, they're fully supported by the language. They've been in
the ISO > standard since 1999.
>
>
This is an exchange posted on 20-Mar-2025 at 19:10 GMT (header
shows 'Thu, 20 Mar 2025 12:10:22 -0700')
>
Clearly, they're not quite as fully supported as short, int etc;
they are usually just aliases. But that needn't stop them being
shown on such a chart.
Standard aliases are part of the language standard, and therefore
standard and fully supported parts of the language.
So, should they have been on that chart?
> and fully supported parts of the language.
Differences between 'unsigned long long int' and 'uint64_t' up to C23:
uint64_t unsigned long long int
Works without header No Yes
Literal suffix No Yes (ULL etc)
Dedicated printf format No Yes (%llu)
Dedicated scanf format No Yes (whatever that might be)
sizeof() might not be 8 No Maybe
Reserved word[1] No Yes
Outside lexical scope[2] No Yes
Incompatible with
unsigned long int No Yes
>
[1] Maybe _t names are reserved, but this:
typedef struct {int x,y;} uint64_t;
compiles cleanly with:
gcc -std=c23 -Wall -Wextra -pedantic
This means that they could legally be used for any user-defined types.
[2] This is possible with uint64_t:
#include <stdint.h>
int main() {
typedef struct {int x,y;} uint64_t;
}
You can shadow the names from stdint.h.
So I'd dispute they are as fully supported and 'special' as built-in
types.
Les messages affichés proviennent d'usenet.