Here is a simple example, what is the output of this program?
```
include
using namespace std;
int main()
{
float f = 0.0;
int i = 5;
f = (float)i;
cout<继续阅读 »
QNAN wiki上是这样说的:
A QNaN is a NaN with the most significant fraction bit set. QNaN’s propagate freely through most arithmetic operations. These values pop out of an operation when the result is not mathematically defined. (details)[http://en.wikipedia.org/wiki/NaN]
我尝试过sqrt(-1), 1/0, NAN/NAN都不行
结果:继续阅读 »
闭包是js中一个难懂又必须征服的概念,他的形成与变量作用域以及变量的生存周期密切相关。
变量作用域和生存周期
作用域,按字面理解,就是指变量的有效范围,超出这个范围就无法访问。
在函数中,里面函数可以访问外面的变量,但是外面无法访问内部变量。举个简单例子:
var a = 1;
var fun1 = function() {
var b = 2;
var fun2 = function() {
var c = 3;
alert(b); //2
alert(c); //3
}
fun2();
alert(c); //c is not de继续阅读 »
xmake provides some project templates, you can easily create an empty project.
Create a c++ console project:
bash
xmake create -l c++ -t 1 demo
or xmake create --language=c++ --template=1 demo
Create a c static library project:
bash
xmake create -l c -t 5 demo
or xmake create --language=c继续阅读 »