#include Typedefsexception_ptr一种类型,描述了一个指向异常的指针terminate_handler一种类型,描述了一个适合作为terminate_handler的函数的指针unexperted_handler一种类型,描述了一个适合作为unexpected_handle...
分类:
其他好文 时间:
2015-07-02 20:53:34
阅读次数:
250
先说总结:说白了提升IRQL其实就是从hal!HalpIRQLtoTPR获取要提升的IRQL级对应的TPR(Tast Preritory Register)值,改写到APIC_TPR地址上去(0xFFFE0080). 然后将旧TPR值,从byte ptr hal!HalpVectorToIRQL,获...
分类:
其他好文 时间:
2015-07-01 20:04:33
阅读次数:
210
以下程序的输出结果
#include
void main()
{
char * ptr="hello";
char str[]="hello";
printf("sizeof(pts) is %d\n", sizeof(ptr));//这里输出指针的大小
printf("sizeof(str) is %d\n", sizeof(str));//这里输出整个st...
分类:
编程语言 时间:
2015-06-29 10:00:44
阅读次数:
133
just read it
smart_ptr: https://mbevin.wordpress.com/2012/11/18/smart-pointers/
move: https://mbevin.wordpress.com/2012/11/20/move-semantics/...
分类:
编程语言 时间:
2015-06-26 13:03:36
阅读次数:
237
以独立语句将newed对象置入智能指针本节我们需要学习的知识核心是注意编译器在同一语句中,调用次序具有不确定性,不同语句中,调用次序确定。
上面的话什么意思?
请看以下代码:int priority();
int processWidget(shared_ptr pw, int priority);
processWidget(shared_prt pw(new...
分类:
编程语言 时间:
2015-06-24 16:22:53
阅读次数:
173
在资源管理器中小心copying行为上节是对资源的管理说明,有时候我们不能依赖于shared_ptr或者auto_ptr,所以我们需要自己建立一个资源管理类来管理自己的资源。例如建立一个类来管理Mutex锁,现在使用函数处理类型为Mutex的互斥器对象class Lock{
public:
explicit Lock(Mutex* mu):mutexPtr(mu)
{...
分类:
编程语言 时间:
2015-06-24 13:05:32
阅读次数:
125
在资源管理类中提供对原始资源的访问前面两节都在讨论如何管理资源,一般情况下,使用资源管理类来屏蔽原始资源,对抗内存泄露等问题,避免使用原始资源。这样我们就无法直接访问原本的原始资源。毕竟程序在有些时候是需要操纵原始资源的,许多APIs要求使用原始资源。为了能操纵原始资源,我们要怎么做?
还好,shared_ptr和auto_ptr都提供一个get函数,用于执行这样的显示转换。这时如果在调用API时...
分类:
编程语言 时间:
2015-06-24 12:59:20
阅读次数:
125
type __sync_fetch_and_add (type *ptr, type value);type __sync_fetch_and_sub (type *ptr, type value);type __sync_fetch_and_or (type *ptr, type value);t...
dummy_function(void){ unsigned char * ptr=0x00; *ptr=0x00;}int main(){ dummy_function(); return 0;}作为一名熟练的c/c++程序员,以上代码的bug应该是很清楚的,因为它尝试操作...
分类:
其他好文 时间:
2015-06-23 00:37:52
阅读次数:
146
#include // The type of a pointer into the init table.typedef void const * table_ptr_t;// The type of an initialization routine. It takes a pointer to...
分类:
其他好文 时间:
2015-06-22 19:15:50
阅读次数:
2029