易截截图软件、单文件、免安装、纯绿色、仅160KB

c宏定义的技巧总结


http://blog.csdn.net/eroswang/archive/2009/06/12/4265046.aspx
1,防止一个头文件被重复包含
#ifndef COMDEF_H
#define COMDEF_H
//头文件内容
#endif
2,重新定义一些类型,防止由于各种平台和编译器的不同,而产生的类型字节数差异,方便移植。
typedef unsigned char      boolean;     /* Boolean value type. */
typedef unsigned long int uint32;      /* Unsigned 32 bit value */
typedef unsigned short     uint16;      /* Unsigned 16 bit value */
typedef unsigned char      uint8;       /* Unsigned 8 bit value */
typedef signed long int    int32;       /* Signed 32 bit value */
typedef signed short       int16;       /* Signed 16 bit value */
typedef signed char        int8;        /* Signed 8 bit value */
//下面的不建议使用
typedef unsigned char     byte;         /* Unsigned 8 bit value type. */
typedef unsigned short    word;         /* Unsinged 16 bit value type. */
typedef unsigned long     dword;        /* Unsigned 32 bit value type. */
typedef unsigned char     uint1;        /* Unsigned 8 bit value type. */
typedef unsigned short    uint2;        /* Unsigned 16 bit value type. */
typedef unsigned long     uint4;        /* Unsigned 32 bit value type. */
typedef signed char       int1;         /* Signed 8 bit val


相关文档:

C/C++程序员面试题

 1、局部变量能否和全局变量重名?  
 答:能,局部会屏蔽全局。要用全局变量,需要使用"::" ;局部变量可以与全局变量同名,在函数内引用这个变量时,会用到同名的局部变量,而不会用到全局变量。对于有些编译器而言,在同一个函数内可以定义多个同名的局部变量,比如在两个循环体内都定义一个同名的局部变量,而那 ......

关于C中结构体的大小问题(sizeof)

作者:
曾宏安,华清远见嵌入式学院
高级讲师。
运算符sizeof可以计算出给定类型的大小,对于32位系统来说,sizeof(char) = 1; sizeof(int) = 4。基本数据类型的大小很好计算,我们来看一下如何计算构造数据类型的大小。
C语言中的构造数据类型有三种:数组、结构体和共用体。
数组是相同类型的元素的集合,只要会计算 ......

Pipe is a worm hole connecting C and C++

In C programming language, the observer design pattern is implemented with function pointer (aka callback function). But in Qt library, it introduces signal and slot. How to link a callback function from the C callback function to the C++ siganl and slot is a problem I encounter. Call back function ......

Excel writing and reading with pure c API

Reading and Writing Excel file with pure C api in windows system. tested on windows 2000, hope it can help you:
#ifndef _WINXLS_H_
#define _WINXLS_H_
/*============================================================================*
*      Include Files
*================== ......

ANSI C——可变参数


【原型】
      type fun( type arg1, type arg2, ...
);
【描述】
       主要用在参数个数不确定的函数中,例如:printf函数。
【使用方法】
参考:glib/manual/Add.c
#include <stdarg.h>
#include <stdio.h>
int add_em_up (int coun ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号