C++基础
一朝柯梦
熙熙攘攘不过梦一场
展开
-
epoll demo
#include<stdio.h>#include<arpa/inet.h>#include<sys/eventoll.h>#include<unistd.h>#include<ctype.h>#define MAXLEN 1024#define SERV_PORT 8000#define MAX_OPEN_FD 1024int main(int argc,char *argv[]){ int connfd = 0;.原创 2020-08-06 23:48:02 · 393 阅读 · 0 评论 -
内核通用链表-双向循环链表
参考文档:https://blog.csdn.net/liebao_han/article/details/53956609?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1(整体讲解通俗易懂,但这个文档.原创 2020-05-09 11:54:58 · 277 阅读 · 0 评论 -
GCC编译路径
1,默认头文件路径:cpp -v 或者 `g++ -print-prog-name=cc1plus` -v2,默认库路径:3,原创 2019-12-18 23:01:12 · 1403 阅读 · 0 评论 -
命令行选项解析函数(C语言):getopt()和getopt_long()
https://www.cnblogs.com/chenliyang/p/6633739.htmloptoptargoptindargv[optind]转载 2019-10-13 18:26:17 · 2796 阅读 · 0 评论 -
C语言 倒计时程序
#include <stdio.h>#include <stdlib.h>int main(){ printf("remain time :\n"); int a=15; while(--a>=0) { printf("%5d\r",a); fflush(stdout); sleep(1); } }只是实现了简单的倒计...原创 2019-09-12 00:57:40 · 4994 阅读 · 0 评论 -
std:lock_guard 不能用在 condition_variable wait中
1, std:lock_guard、unique_lock、condition_variable 一般使用实例#include <condition_variable>#include <mutex>#include <future>#include <iostream>bool readyFlag; std::mutex read...原创 2019-06-30 17:55:07 · 1124 阅读 · 2 评论 -
centos 6.10 安装 gcc 7.3
checking for suffix of object files... configure: error: in `/root/gcc-4.7.2/x86_64-unknown-linux-gnu/libgcc':configure: error: cannot compute suffix of object files: cannot compileSee `config.log' ...原创 2019-05-24 20:26:16 · 1902 阅读 · 0 评论 -
terminate called after throwing an instance of 'std::cad_alloc' what():std::bad_alloc
内存不够:1,确认系统已占用内存是否正常,排除数据量过大导致的问题,此时系统内存不足导致 std::bad_alloc内存剩余:1,确认接口调用时,调用和背调接口的的参数是否一致,动态库库调用中若不一致,编译链接通过,但执行可能导致 std::bad_alloc2,确认是否使用vector,vector超容量时会重新申请二倍内存,因为vector会将老的一块内存,完全拷贝到另一块连...原创 2019-02-01 18:22:33 · 54776 阅读 · 4 评论 -
C++ STL Vector与List区别
第二点和第三点在海量数据应用时重点关注,会影响内存利用率和存储性能 1,vector内存是连续的,list链表内存不连续2,vector会预分配内存,capacity为vector实际内存大小,list内存分配为实际数据大小3,vector内存达到capacity容量时将vector数组全部拷贝到新的capacity大小的内存区域,会比list多进行内存拷贝4,vecto...原创 2019-01-20 23:00:56 · 1996 阅读 · 0 评论