April 2020
Intermediate to advanced
412 pages
9h 58m
English
In this recipe, we will learn how to preallocate memory and use it later in your application:
#include <cstdint>#include <string.h>constexpr size_t kMaxFileNameSize = 256;constexpr size_t kBufferSize = 4096;constexpr size_t kMaxDevices = 16;class SerialDevice { char device_file_name[256]; uint8_t input_buffer[kBufferSize]; uint8_t output_buffer[kBufferSize]; int file_descriptor; size_t input_length; size_t output_length; public: SerialDevice(): file_descriptor(-1), ...Read now
Unlock full access