
c++
文章平均质量分 68
lyf5231
Work with all of you to build the world we want!
展开
-
不同平台的C/C++标准库
不同平台中C、C++的标准库介绍。原创 2022-09-21 15:22:37 · 8224 阅读 · 1 评论 -
利用Valgrind进行内存泄露检查
Note: Valgrind is Linux only. If you aren’t running Linux, or want a tool designed from the start to make debugging segfaults and memory issues easier, check out Cee Studio, a fully online C and C++ development environment from our sponsor. Cee Studio pro.原创 2021-03-31 16:25:54 · 656 阅读 · 0 评论 -
动态链接库之dllexport和__attribute__(visibility)
在实际的应用中,我们需要动态库导出特定的符号(有些接口不对外暴露,只内部使用),下面的例子展示了具体的实现方式。1. code//log.h#pragma once#define BUILDING_DLL#if defined _WIN32 || defined __CYGWIN__#ifdef BUILDING_DLL#ifdef __GNUC__#define DLL_PUBLIC __attribute__ ((dllexport))#else#define DLL_PUBLI原创 2021-03-31 16:22:46 · 2552 阅读 · 1 评论 -
不同操作系统相关的宏
1. win32或者win64_WIN32 Defined as 1 when the compilation target is 32-bit ARM, 64-bit ARM, x86, or x64. Otherwise, undefined._WIN64 Defined as 1 when the compilation target is 64-bit ARM or x64. Otherwise, undefined.#if defined(_WIN32)#define OS_WINDO原创 2021-03-31 15:59:08 · 846 阅读 · 0 评论 -
std vector如何避免频繁内存创建
1. std vector中添加元素In C++ vectors are dynamic arrays. Unlike arrays, they don’t have a fixed size. They can grow or shrink as required. Vectors are assigned memory in blocks of contiguous locations. When the memory allocated for the vector falls short of原创 2021-03-13 16:55:55 · 666 阅读 · 0 评论 -
Functors: Function Objects in C++
Both C and C++ support function pointers, which provide a way to pass around instructions on how to perform an operation. But function pointers are limited because functions must be fully specified at...转载 2018-03-07 15:40:47 · 536 阅读 · 0 评论 -
The C++ 'const' Declaration: Why & How
The ‘const’ system is one of the really messy features of C++. It is simple in concept: variables declared with ‘const’ added become constants and cannot be altered by the program. However it is also...转载 2018-02-23 10:23:40 · 346 阅读 · 0 评论 -
Constructors in Cpp
What is constructor?A constructor is a member function of a class which initializes objects of a class. In C++,Constructor is automatically called when object(instance of class) create.It is special...原创 2018-04-17 11:25:22 · 742 阅读 · 0 评论