nerver suppose that a point value is NULL or int value is 0 when defined a variant
来源:互联网 发布:人人分销系统源码 编辑:程序博客网 时间:2024/06/16 03:13
when I read some book about C/C++, it's always give a hint that an int variant is assigned to zero automatically . however it doesn't always the tureth
see the test code:
/* by vinco at 2011-08-03* os : Ubuntu* compiler :CC for GCC*/#include<stdio.h>int main(){ char* str;// = NULL; int i;//=0 if(NULL == str) printf("str == NULL\n"); else printf("str != NULL\n"); if( 0==i ) printf("i == 0\n"); else printf("i != 0\n"); return 0;}
when compile and run it:
root@vinco:/home/vinco# make nullcc null.c -o nullroot@vinco:/home/vinco# ./nullstr != NULLi != 0
you'd better initial the variant firstly once you define it, to make your code more robust or less bug!
- nerver suppose that a point value is NULL or int value is 0 when defined a variant
- SQL : Compare a column's value is null or not ? is null
- Passing by reference or by value? it is a question
- Effective C#之8:Ensure That 0 Is a Valid State for Value Types
- Optional int parameter 'folderId' is not present but cannot be translated into a null value due to b
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'page' is present but cannot be translated into a null value due to being dec
- Optional int parameter 'version' is present but cannot be translated into a null value due to being
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'rip' is present but cannot be translated into a null value due to being decl
- Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'pageNumber' is present but cannot be translated into a null value due to bei
- Check if a string value is numeric
- value.toFixed is not a function
- PostBack the form when a value is selected from the results returned by autocomplete extender
- not-null property references a null or transient value
- 关于:not-null property references a null or transient value
- poj 1617
- Gallery Tutorials 详解
- 全局变量、静态全局变量、静态局部变量、局部变量
- iOS-利用本地数据来代替远程UIWebView请求
- C#中可选参数和命名参数的定义及使用
- nerver suppose that a point value is NULL or int value is 0 when defined a variant
- CString、LPCTSTR、LPTSTR、TCHAR、WCHAR、string、wchar_t、char解析
- Android OpenglES 绘制多个纹理
- Membase和Java入门
- java 深克隆与浅克隆
- 《人生的意义与价值 》季羡林
- tomcat启动异常:Address already in use: JVM_Bind
- jsp应用开发详解笔记
- Singleton(单件)- 对象创建型模式