Questions tagged [cstdint]

Header that declares types and macro constants to deal with fixed-width cross-platform integer types, available since C++11. This header replaces stdint.h wich is tagged as deprecated.

30 questions
2
votes
1 answer

Can't find symbols in stdint.h

When I used Apportable for my C++ source code, It cannot find symbols defined in stdint.h. error: use of undeclared identifier 'UINT8_MAX' The code worked well with Xcode, and this error raised only on Apportable. I added #include , but…
eonil
  • 75,400
  • 74
  • 294
  • 482
1
vote
1 answer

Different behaviors in strringstream given std::hex, uint8_t vs int

I suppose the fact that uint8_t is really just an alias for char means that when the characters in the stringstream get read back in, they are stored natively, i.e. the ascii code for the character, whereas if the char is input to an int, with…
Joshua
  • 346
  • 3
  • 15
1
vote
0 answers

C++ random output when using

I have the following code in my project: #include #include #include int main() { std::queue queue; queue.push(5); std::cout << queue.front() << std::endl; int8_t value = 10; std::cout <<…
1
vote
3 answers

Why sscanf can't read an uint64_t and a char from one string?

#include #include #include int main() { std::uint64_t ui; char c; auto ret = std::sscanf("111K", "%lu64%[B, K, M, G]", &ui, &c); assert(ret == 2); assert(ui == 111); } I tried to use sscanf to read…
JiaHao Xu
  • 1,556
  • 8
  • 21
1
vote
0 answers

What data type, scheme, and how many bits should be used to store a FOREX price?

A typical FOREX price would be carried out to the 4th decimal place; for example, the current price of the GBP against the USD today is 1.2515. I have seen this price carried out to more decimal places. This is really a two-part…
kmiklas
  • 11,204
  • 17
  • 55
  • 84
1
vote
1 answer

Converting 16-bit integer to 8-bit integer?

I'm implementing C code to copy a 16-bit sign and magnitude integer to an 8-bit sign and magnitude integer. Is that even possible? Could someone please explain how to do this? code snippet: int16_t a = 0x1234; int8_t b, c; How to copy first two…
Rohith Gowda
  • 127
  • 1
  • 2
  • 12
1
vote
1 answer

cstdint file not found when building on the command line

I'm trying to build a couple of projects on the command like but I keep getting screwed up by an failure to find . The project tries to build an when it gets to a specific line in the include path, specifically #include it throws…
Ryan Bartley
  • 586
  • 7
  • 17
0
votes
1 answer

C++ F32 include file?

I've just begun to write my own memory manager, but to do that, I need some type of include file to create a f32 (float integer). I have #include in my program already, but I'm not sure what I would need for a F32, or I32 for that matter.
metalgod88
  • 13
  • 1
  • 3
0
votes
0 answers

Is there any benefit to using `std::numeric_limits::max()` instead of simply `UINT64_MAX`? (ie: `std::numeric_limits<>` vs cstdint)

UINT64_MAX is defined in : https://en.cppreference.com/w/cpp/header/cstdint. This is what I've always used. However, I see C++ provides this alternative as well: std::numeric_limits::max() (see:…
Gabriel Staples
  • 11,777
  • 3
  • 74
  • 108
0
votes
1 answer

cstdint string c++>C11 int /usr/include/c++/8/cstdint:53:11: error: ‘::int_fast8_t’ has not been declared

I have a program that was written in C ++ 1996, and I would like to compile this to C ++ 17. I get an error message when add #include and I am referred to cstdint. This lacks the declaration of: / usr / include / c ++ / 8 / cstdint: 51: 11: error:…
TEDAVL
  • 1
  • 1
0
votes
2 answers

C++ 11 int8_t buggy input/output

This is a snipped of code from my program. I am using the int8_t data type, and I'm having some problems with input/output. Apparently, using int8_t in the program requires the -std=c++11 flag to be set for the g++ compiler. I did that, but there…
Galaxy
  • 1,856
  • 1
  • 14
  • 39
0
votes
1 answer

Can cstdint typedefs bind to some implementation specific types std::numeric_limits is not specialized for?

Is it possible, at least theoretically, that cstdint typedefs bind to some implementation specific types std::numeric_limits is not specialized for? According http://www.cplusplus.com/reference/limits/numeric_limits , let me quote,…
user4385532
0
votes
0 answers

Bluez libraries cause a lot of problems

I'm trying to compile a C++ project on raspberry pi B+ in codeblocks. Code is taken from here #include #include #include #include #include #include #include…
r_spb
  • 65
  • 1
  • 11
-1
votes
1 answer

Why is int_fast16_t 64 bits on a 64-bit system?

I looked inside the header file on my implementation. I see the following: typedef long int int_fast16_t; typedef long int int_fast32_t; typedef long int int_fast64_t; I have a 64-bit system, so a long int occupies 64 bits. Why are all…
Galaxy
  • 1,856
  • 1
  • 14
  • 39
-4
votes
1 answer

Why are the *_leastN_t and *_fastN_t types required, not optional?

We all know that the exact-width integer typedefs defined in C99's stdint.h are optional, being defined only if the architecture has primitive types of those widths, signs, etc. However, I just now realised that [u]int_(fast|least)N_t are not…
underscore_d
  • 5,331
  • 3
  • 29
  • 56
1
2