redis源码

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 版本使用6.2.4 sds.h sds.c内存对齐__attribute__((__packed__))可以让编译器对结构体不进行内存对齐,详细参考 1234567891011121314151617181920212223242526#include <stdint.h>#include <stdio.h>struct __attribute__((__packed__)) sdshdr64 { uint64_t len; /* used */ uint64_t alloc; /* excluding the header and null terminator */ unsigned char flags; /* 3 lsb of type, 5 unused bits */ char buf[];};struct _sdshdr64 { uint64_t len; /* used */ uint64_t alloc; /* excluding the header and null terminator */ unsigned char flags; /* 3 lsb of type, 5 unused bits */ char buf[];};int main() { printf("packed: %d\n", sizeof(struct sdshdr64)); printf("nopacked: %d\n", sizeof(struct _sdshdr64));}/*gcc a.c -o a && ./apacked: 17nopacked: 24*/ 宏####后标识的字符串会被替换,然后其左右的内容加上自己会被合并到一起,编译器将其视为标识符进行解析,详细参考     阅读全文
fightinggg's avatar
fightinggg 6月 26, 2021

docker-mysql

    阅读全文
fightinggg's avatar
fightinggg 3月 15, 2021

mysql常用指令

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial Mysql查看表的定义1show create table table_name;     阅读全文
fightinggg's avatar
fightinggg 1月 03, 2021

mysql-入门

    阅读全文
fightinggg's avatar
fightinggg 4月 13, 2020

mysql游标

    阅读全文
fightinggg's avatar
fightinggg 4月 08, 2020

redis

    阅读全文
fightinggg's avatar
fightinggg 4月 07, 2020

mysql刷题1

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 查找最晚入职员工的所有信息查找最晚入职员工的所有信息CREATE TABLE employees (emp_no int(11) NOT NULL,birth_date date NOT NULL,first_name varchar(14) NOT NULL,last_name varchar(16) NOT NULL,gender char(1) NOT NULL,hire_date date NOT NULL,PRIMARY KEY (emp_no)); 我们排序以后选出最大的 123select * from employees order by hire_date desc limit 0,1 找到最大值以后使用where 12select * from employees where hire_date = (select max(hire_date) from employees);     阅读全文
fightinggg's avatar
fightinggg 4月 06, 2020