• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
sfesly
博客园 首页 新随笔 联系 订阅 订阅 管理
上一页 1 2 3 4 5 6 ··· 13 下一页

2016年1月4日

C++ friend keyword
摘要: You often need to split a class in half when the two halves will have different numbers of instances or different lifetimes. In these cases, the two h... 阅读全文
posted @ 2016-01-04 13:27 sfesly 阅读(155) 评论(0) 推荐(0)
 
Should I design my classes from the outside (interfaces first) or from the inside (data first)?
摘要: From the outside! 阅读全文
posted @ 2016-01-04 10:24 sfesly 阅读(151) 评论(0) 推荐(0)
 
 

2016年1月3日

C++ 构造与析构函数
摘要: 这两个概念并不对等,构造函数可以完全控制成员构造过程(通过初始化列表),析构函数准确说应该叫析构之前被调用的函数一般不应该手动调用析构函数:栈区对象会自动析构,堆区也是在delete的时候析构有一个特例,就是placement new的时候 void someCode() { ... 阅读全文
posted @ 2016-01-03 09:24 sfesly 阅读(155) 评论(0) 推荐(0)
 
 

2016年1月2日

C++异常处理的问题
摘要: 一般在C语言中,是通过返回值或者设置errno的方式来标识错误的但在C++里面,构造函数是没有返回值的,于是发明了异常的方式:为了正确的向使用者表明异常抛出的原因,你必须弄清楚异常抛出的原因(比如有的是内存分配的时候出错,有的是成员构造出错)还有一点需要注意,析构函数,从实现上不该抛异常的,因为析构... 阅读全文
posted @ 2016-01-02 21:05 sfesly 阅读(193) 评论(0) 推荐(0)
 
 

2015年12月31日

C++ iostream的线程安全性问题
摘要: 标准C里面的printf, fprintf之类的,会给FILE指针上锁(在unix平台上就是记录锁,按照msdn的说法windows上也有类似的锁),所以单次函数调用总是线程安全的:要注意,这里只对文件上锁,不是在操作过程中锁互斥量之类的,所以参数并不是线程安全的对于iostream,如果按照默认的... 阅读全文
posted @ 2015-12-31 17:03 sfesly 阅读(1143) 评论(0) 推荐(1)
 
 

2015年12月29日

linux信号处理时机
摘要: 信号号称所谓软中断,事实上,还是没有真正的硬件中断那样能随时改变cpu的执行流硬件中断之所以能一发生就得到处理是因为处理器在每个指令周期的结尾都会去检查中断,这种粒度是很细的但是信号的实现只是在进程的task_struct里面有一个成员用于标识当前收到了哪些信号?而这个成员的检查显然只能在特定时间点... 阅读全文
posted @ 2015-12-29 18:53 sfesly 阅读(1131) 评论(0) 推荐(0)
 
C++指针比较的问题
摘要: 在C++里面,指针的比较是要保障type-safe的,也就是说,这两个指针必须是convertible的:从一个指针能够直接转换到另一个指针(有中间路径不算,不然都往void*转没完没了),顺序不限比如任意类型的指针和void*比如指向基类的指针和指向派生类的指针又比如任意类型的指针和nullptr... 阅读全文
posted @ 2015-12-29 11:17 sfesly 阅读(491) 评论(0) 推荐(0)
 
 

2015年12月25日

What is a watch descriptor
摘要: http://stackoverflow.com/questions/24342156/what-are-watch-descriptors-really-linux-inotify-subsystem 阅读全文
posted @ 2015-12-25 10:21 sfesly 阅读(156) 评论(0) 推荐(0)
 
 

2015年12月24日

Linux filesystem detection
摘要: 16 down vote accepted The reason you can't find it is because, for the most part, it's not in the kernel -- it's in the userspace mount utility, which... 阅读全文
posted @ 2015-12-24 10:52 sfesly 阅读(326) 评论(0) 推荐(0)
 
O_NONBLOCK on regular file
摘要: It seems that writes/reads to regular files can't not be made non-blocking. I found the following references for support:from The Linux Programming In... 阅读全文
posted @ 2015-12-24 10:24 sfesly 阅读(883) 评论(0) 推荐(0)
 
 
上一页 1 2 3 4 5 6 ··· 13 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3