整型溢出还有这么多操作
https://coolshell.cn/articles/11466.html
coolshell里的一些c++文章
c++数组不支持多态https://coolshell.cn/articles/9543.htmlwhygccinc++https://airs.com/ian/cxx-slides.pdfc++坑多吗https://coolshell.cn/articles/7992.htmlwhyc++http
uint16
my_global.h
头文件
头文件尽量加在.cc文件中只有需要,才加在.h中
继承问题
继承层次尽量少,但是千万不能因为这个原则,违反实际继承关系
records_in_range start_key, end_key
select*fromfederatedTestwherename='aaa';(gdb)p*start_key$2={key=0x7f64f4103be8"",length=23,keypart_map=1,flag=HA_READ_KEY_EXACT}(gdb)p*end_key$3={key=
c++ singleton
http://www.yolinux.com/TUTORIALS/C++Singleton.html
特殊字符转义
voidString::print(String*str){char*st=(char*)Ptr,*end=st+str_length;for(;st<end;st++){ucharc=*st;switch(c){case'\\':str->append(STRING_WITH_LEN(
固定长度与非固定长度字符串选择
长度相对固定,浪费不明显的情况下用定长的字符串长度不固定,变化区间可能很大用变长的性能考虑预分配一个能包含90%场景的的长度
遍历操作模板
for(std::list<char*>::iteratoriterator_condition_columns=\condition_columns.begin();;){begin_offset+=sprintf(condition_begin_limit_rows+begin_of
可维护性
入参合法判断入参若为对象,存取函数打印出异常情况
读google c++规范笔记
全局变量在main函数之前初始化原则上禁止拷贝构造函数和赋值函数如果只有数据,没有方法,可以用struct析构函数声明为虚函数尽量避免重载操作符难以定位的bug误以为简单的操作存取控制可以放到声明文件中输入参数为值或者常数引用,输出参数为指针overloading函数名相同,但是参数不同overri
构造函数内调用虚函数
不会转发到子类中
临时变量
在最近使用的地方,再声明和定义
软件设计套路
调研整理思路流程图类设计序列图(可能)
mysql中的直方图采样逻辑
inthandler::sample_next(uchar*buf){//TemporarysetinitedtoRND,sincewearecallingrnd_next().intres=rnd_next(buf);std::uniform_real_distribution<double
图中有个索引不存在,但是仍然能显示出来
mysql c 获取error_code
#include<stdio.h>#include<mysql.h>intmain(intargc,char**argv){MYSQL*con=mysql_init(NULL);if(con==NULL){fprintf(stderr,"%s\n",mysql_error(c
nested class 例子
#include<iostream>usingnamespacestd;/*startofEnclosingclassdeclaration*/classEnclosing{private:intx;/*startofNestedclassdeclaration*/classNested
定义和实现相同的顺序
a