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

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - 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 (吴俊)
版权所有,未经允许,不得转载
---------------------------------------------------