• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






你,遗忘。

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2018年4月24日

二叉树的递归和非递归实现
摘要: #include #include #include using namespace std; struct BtreeNode{ BtreeNode(int value, struct BtreeNode *parent, struct BtreeNode *left, struct BtreeNode *right){ this->value = value; this-... 阅读全文
posted @ 2018-04-24 16:29 你,遗忘。 阅读(238) 评论(0) 推荐(0)
 

2018年4月8日

Divide two integers without using multiplication, division and mod operator.
摘要: int divide(int dividend, int divisor) { //除数不能为零, 防止溢出(4bits: 0到7 和 -8到-1, -8除以 -1 = 8 溢出) if(divisor == 0 || (dividend == INT_MIN && divisor == -1)) return INT_MAX; i... 阅读全文
posted @ 2018-04-08 12:24 你,遗忘。 阅读(132) 评论(0) 推荐(0)
 

2017年10月14日

dmesg和addr2line 定位 segfault
摘要: 程序长时间运行崩溃,但是没有保存core dump消息。可以用下面的方法定位出程序出错位置: 1. 用dmesg查找出错的代码段地址 ip 000000000041ccec 发生错误时指令的地址, sp sp 00007fff53c48700 堆栈指针 error 4的意义如下,可以对照参考: bi 阅读全文
posted @ 2017-10-14 12:01 你,遗忘。 阅读(1904) 评论(0) 推荐(0)
 

2017年8月24日

Interface request structure used for socket ioctl's
摘要: 1. 结构体定义 ifreq结构定义在/usr/include/net/if.h;用来配置ip地址,激活接口,配置MTU等接口信息的。 获取本机ip: 2. ioctl声明 SIOCGIFCONF SIOCSIFADDR SIOCGIFADDR SIOCSIFBRDADDR SIOCGIFBRDAD 阅读全文
posted @ 2017-08-24 11:43 你,遗忘。 阅读(233) 评论(0) 推荐(0)
 

2017年8月20日

epoll模型的使用
摘要: 1. 创建epoll句柄 int epfd = epoll_create(int size); 该函数生成一个epoll专用的文件描述符。它其实是在内核申请一空间,用来存放你想关注的socket fd上是否发生以及发生了什么事件。size就是你在这个epoll fd上能关注的最大socket fd数 阅读全文
posted @ 2017-08-20 12:00 你,遗忘。 阅读(264) 评论(0) 推荐(0)
 

2017年6月15日

IP报文分片
摘要: 1. 最大传输单元(Maximum Transmission Unit,MTU)。 以太网帧中的数据长度规定最小46 字节,最大1500 字节,MTU 指数据帧中有效载荷的最大长度,不包括帧首部的长度。 2. IP帧格式, 4 位首部长度的数值是以4 字节为单位的,最小值为5,也就是说首部长度最小是 阅读全文
posted @ 2017-06-15 11:15 你,遗忘。 阅读(9069) 评论(0) 推荐(1)