摘要: _cdecl右->左调用者负责pascal被调用者负责__fastcall右->左,寄存器传参被调用者负责__stdcall右->左被调用者负责 阅读全文
posted @ 2013-10-23 19:47 LambdaTea 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://en.wikipedia.org/wiki/Scope_(computer_science)#Lexical_scoping_vs._dynamic_scopingThe use of local variables — of variable names with limited scope, that only exist within a specific function — helps avoid the risk of a name collision between two identically named variables. However, there ar 阅读全文
posted @ 2013-10-20 00:03 LambdaTea 阅读(1478) 评论(0) 推荐(0) 编辑
摘要: 0. C++11 compiler support shootouthttp://cpprocks.com/c11-compiler-support-shootout-visual-studio-gcc-clang-intel/http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx1. Important Minor Syntax Cleanups//Spaces in Template Expressionsstd::vector>;//nullptr and std::nullptr_tf(0); //calls f 阅读全文
posted @ 2013-10-19 16:18 LambdaTea 阅读(387) 评论(0) 推荐(0) 编辑
摘要: /* range.js */function range(from, to) { var r = inherit(range.methods); r.from = from; r.to = to; return r;}range.methods = { includes: function(x) { return this.from <= x && x <= this.to; }, foreach: function(f) { for (var x=Math.ceil(this.from); x<=this.to; x++)... 阅读全文
posted @ 2013-10-19 15:42 LambdaTea 阅读(184) 评论(0) 推荐(0) 编辑
摘要: var strict = (function() { return !this;}());//function getPropertyNames(o, /* optional */ a) { if (a === undefined) a = []; /* a = a || [] */ for(var property in o) { a.push(property); } return a;}/* callee 当前正在执行的函数, caller 当前正在执行的函数的函数 *///var scope = "global scope";function... 阅读全文
posted @ 2013-10-19 15:05 LambdaTea 阅读(175) 评论(0) 推荐(0) 编辑
摘要: /* array */var empty = [];var primes = [2,3,5];var misc = [1.1, true, "a"];//var a = new Array(10);//a = [1,2,3];Object.defineProperty(a, "length", {writable: false});a.length = 0; //a will not changevar keys = Object.keys(o); //获得o对象属性名组成的数组var values = [];for(var i = 0; i<ke 阅读全文
posted @ 2013-10-19 14:39 LambdaTea 阅读(126) 评论(0) 推荐(0) 编辑
摘要: var o3 = Object.create(Object.prototype); //equals new Object()//function inherit(p) { if(p==null) throw TypeError(); if(Object.create) { return Object.create(p); } var t = typeof p; if(t!=="object" && t!=="function") throw TypeError(); function f() {}; f.prototype = p; . 阅读全文
posted @ 2013-10-18 19:43 LambdaTea 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 1 //object 2 var book = { 3 topic: "JavaScript", 4 fat : true 5 }; 6 book.topic = "CPP"; 7 8 //array 9 var primes = [2,3,5,7];10 primes.length11 12 //13 var points = [14 {x:0, y:0},15 {x:1, y:1}16 ];17 var data = {18 t... 阅读全文
posted @ 2013-10-18 17:23 LambdaTea 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://en.wikipedia.org/wiki/Win32_Thread_Information_BlockFS:[0x18]4Win9x and NTLinear address of TIB// gcc (AT&T-style inline assembly).void *getTIB(){ void *pTib; __asm__("movl %%fs:0x18, %0" : "=r" (pTib) : : ); return pTib;}// Microsoft Cvoid *getTib(){ void *pTib; __asm 阅读全文
posted @ 2013-10-13 13:39 LambdaTea 阅读(338) 评论(0) 推荐(0) 编辑
摘要: function decimalToHexString(number) { if (number < 0) { number = 0xFFFFFFFF + number + 1; } return number.toString(16).toUpperCase();} 阅读全文
posted @ 2013-07-02 15:54 LambdaTea 阅读(369) 评论(0) 推荐(0) 编辑