首页 > 编程语言 > 详细

Modern C++ Course [Lecture 6] {Static, Numbers in memory, Raw C arrays, Non-owning pointers, Classes in memory}

时间:2018-12-31 14:22:05      阅读:239      评论:0      收藏:0      [点我收藏+]

技术分享图片

 

 

every object of the same class can equally gets access to the static variable

 技术分享图片

 

 

 

技术分享图片

 

float has limited precision, eg, float x = 1.0;

but x = 0.99999987 things like this.

 

技术分享图片

 

 

 技术分享图片

 

 技术分享图片

 

 技术分享图片

 

 技术分享图片

 

 

技术分享图片

destroy precision of demicals when add huge numbers to small numbers

 

 

技术分享图片

 

 技术分享图片 set precision(20)

10M + PI

 

 技术分享图片

1M + PI

length of decimal part is nonlinear....???

 

技术分享图片

 

 

技术分享图片

there‘s no way of knowing in the function what‘s the size of the array you are passing.

and you can read any memory you want and this is dangerous

 

技术分享图片

 

 just make it a rule, never ever create a pointer without initialization.

 if a nullptr is used without further declaration, compiler would show you a "segmentation error"

 

 

技术分享图片

 

 

技术分享图片

 

 

 

   技术分享图片

 

 技术分享图片

 

 

 

技术分享图片

 

 

技术分享图片

custom objects have variables in memeory stored together, but some padding may be inserted.

 

Modern C++ Course [Lecture 6] {Static, Numbers in memory, Raw C arrays, Non-owning pointers, Classes in memory}

原文:https://www.cnblogs.com/ecoflex/p/10201933.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!