易截截图软件、单文件、免安装、纯绿色、仅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.介绍一下STL,详细说明STL如何实现vector.
    Answer:
    STL (标准模版库,Standard Template Library.它由容器算法迭代器组成。
    STL有以下的一些优点:可以方便容易地实现搜索数据或对数据排序等一系列的算法;调试程序时更加安全 和方便;即使是人们用STL在 ......

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 ......

C和C++中的CONST  

C中的CONST  
C中CONST的使用:
  const是一个C语言的关键字,它限定一个变量不允许被改变。使用const在一定程度上可以提高程序的安全性和可靠性,另外,在观看别人代码的时候,清晰理解const所起的作用,对理解对方的程序也有一些帮助。
  虽然这听起来很简单,但实际上,const的使用也是c语言中一个比较微妙的地 ......

C库函数字符串处理函数的C实现(常见)

1.strlen()
实现:
    size_t  strlen(const char *s)
    {
       size_t n;
       for(n = 0; *s != '\0'; s++)
          ++n;
       return n;
  ......

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号