C++ Logo

std-discussion

Advanced search

Re: unsigned type keywords

From: Phil <std-discussion_at_[hidden]>
Date: Wed, 1 Feb 2023 12:39:37 +0100
Hi,

sorry if I don’t got the question right but what is wrong with

unsigned char
unsigned short
unsigned int
unsigned long

if you want, you can define your own types using these ones by using typedefs or alias declarations like

typedef unsigned char byte;
using ushort = unsigned short;

As far as I know, C++ (the language itself, not the standard library) tries to provide some basic constructs necessary for writing program code (in a nutshell). The standard library - on top of the language - leverages this general and „simple“ core-language by providing more specialized functionality at a higher level, e.g. fixed-size integers via cstdint.

Also, since C++11 the fixed-with integer types introduced by C99’s <stdint.h> are available via <cstdint> and are therefore always part of the standard library (of course, since C++11).

While not part of the standard before C++11, most compilers often ship with a C-Compiler and therefore a C-Library-Implementation as well. More than often the available C standard library is >= C99 and you will be able to include <stdint.h> - if available. That is of course not guaranteed since it is not part of the C++ standard pre C++11.

KR
Chilippso



Von meinem iPhone gesendet
> Am 01.02.2023 um 08:11 schrieb Kurt Raburn via Std-Discussion <std-discussion_at_[hidden]>:
>
> 
> hello, everyone.
>
> why doesn't the standard have keywords like these for unsigned types?
>
> byte
> ushort
> uint
> ulong
>
> i mostly use type definitions from cstdint.h and minwindef.h or the auto keyword. i used the site search function (and a search engine) before asking, so please excuse me if this has been answered. i thought this would be the best place to ask.
>
> thanks.
>
>
>
>
>
>
>
>
>
>
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion

Received on 2023-02-01 11:40:02