- 博客(3)
- 收藏
- 关注
原创 C++常见数据类型大小
0xffff 转换成二进制 一个f代表15 转换成二进制是 1111 4个f,所以是1111 1111 1111 1111 2^16 = 65535 LONG_MIN constant is a macro constant which is defied in climits header, it is used to get the minimum value of a long int object, it returns the minimum value that a long int obje
2021-07-02 18:03:30 448
原创 C++类不变式Invariants
类必须实现不变式(Classes Should Enforce Invariants) Bjarne Stroustrup: 我的基本原则式真正的类必须有一个接口,有一个隐含的不变式(invariant) Bill Venners: 不变式(invariant)是什么东西? Bjarne Stroustrup: 什么使一个对象(object)有效?是不变式(invariant)。我以vector举例说明。vector知道自己有n个元素(element),vector也知道自己有一个指针指向这些元素。以上两点
2021-06-06 07:10:04 809
转载 malloc/free 与new/delete 使用区别
malloc/free 与new/delete 区别总结 参考了一些博主的,作总结如下: 原文链接:https://blog.csdn.net/cherrydreamsover/article/details/81022039 1、 malloc/free 是c/c++ 标准库函数 new/delete 是c++操作符 2、 申请内存位置不同 new操作符 在自由存储区上为动态分配内存空间的, malloc从堆上动态分配内存。 自由存储区是C++基于new操作符 C++内存布局:内存区分为5个区,栈、堆、自
2021-04-01 13:40:37 147
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人