A
A
Alexander2016-02-21 15:00:00
linux
Alexander, 2016-02-21 15:00:00

Need an integer data type of 8 bytes and 3 bytes C++, how to do it?

I need an integer (preferably another unsigned type) data type of 8 and 3 bytes C++, how to do it? Without using classes. To be cross-platform Windows / Linux.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Movchan, 2016-02-21
@Alexander1705

Use cstdint . 3-byte type does not exist, use 4-byte type.

#include <cstdint>

int64_t foo; uint64_t bar; // 8 байт. Знаковый и беззнаковый.
int32_t foo; uint32_t bar; // 4 байта. Знаковый и беззнаковый.

V
Vasily, 2016-02-21
@Foolleren

x64 processors at the instruction level operate with data types of 1, 2, 4, 8 bytes for 3 bytes, you will have to trick your bike, you can do it without and without classes, but with pointers and your own functions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question