惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - Skyman

XML文件修改 - Skyman - 博客园 IE和FireFox中JavaScript的函数名的作用域的异同 - Skyman - 博客园 Javascript的assert() gif test CSS Sprites Ha, I Can Touch The Ball Anywhere 几何变换矩阵 我的3D化身(Avatar) 真人3D Avatar 3D Dirichlet Free-Form Deformation(三维Dirichlet自由变形) UV UnWrap(UV展开) 图片拼接镶嵌(OpenGL实现) 模拟人生2人脸制作(转载) 脸部的黄金比例(转载) 使用WTL实现不规则窗口 最近在读《圣经》 《虚拟情人》Demo视频演示 《虚拟情人- Simone》 Demo演示 Papervision3D(Version 1.5)引擎源代码分析
周记(081124-081128)
Skyman · 2008-11-28 · via 博客园 - Skyman

1.
typedef struct ms1
{
     char a;
     int b;
} MS1;

在VC编译器中,sizeof(MS1)默认是8,而不是5,因为有内存对齐。合理安排结构体的字段声明顺序有时可以节省内存空间;
不同编译器默认的最大对齐字节数是不一样的,比如vc==8,gcc==4,可以通过#progma pack (n)来修改,分析程序的时候要注意编译器的区别;
double类型在vc里面alignment modulus == 8,而在gcc里面由于默认最大对齐个数是4,不设置的话,alignment modulus == 4.
详见:

http://blog.csdn.net/manbug/archive/2006/08/26/1124845.aspx

2.  移位运算符的优先级低于算术运算符,高于关系运算符,它们的结合方向是自左至右。如x-y<<4和x-(y<<4)是不一样的,前者相当于(x-y)<<4。

3.

C++类对应的内存结构:真空类大小为1;类内部的成员函数并不会影响类大小,成员数据才影响类大小。
详见:http://blog.csdn.net/guogangj/archive/2008/01/11/2036785.aspx

4. 在VC中使用调试堆来查程序的内存泄漏:

    (1)在头文件里(比如stdafx.h):
          #if defined(_DEBUG) && !defined(DEBUG_NEW)
          #define _CRTDBG_MAP_ALLOC
          #include <stdlib.h>
          #include <crtdbg.h>
          #define DEBUG_NEW new(_NORMAL_BLOCK,THIS_FILE,__LINE__)
          #endif
    (2)在cpp文件中的头部:
          #ifdef _DEBUG
          #define new DEBUG_NEW
          #undef THIS_FILE
          static char THIS_FILE[] = __FILE__;
          #endif

     这样,当在debug模式下按F5运行程序,当程序退出时,若有内存泄漏,则会在Output窗口显示是哪个文件的哪一行代码发生内存泄漏。

5. Euler Angle和Quaternion之间的关系:
     q=[cos(angle/2),sin(angle/2)axis]
     其中:q为四元数(单位四元数);angle为旋转角;axis为一向量,是旋转轴

     sina=sqrt(1-qw×qw)
     angle=2×cos-1(qw)

     axisx=qx/sina
     axisy=qy/sina
     axisz=qz/sina

---------------------------------------------------
Author: Skyman (吴俊)
版权所有,未经允许,不得转载
---------------------------------------------------