GNU C ANSI C 一些区别
1 可变数据结构
struct var_data
{
int len;
char data[0];
};
遍历len后数据
for(i = 0; i < s.len; i++)
{
printf("%02x",s.data[i]);
}
2 case 范围区间 【x,y】
3 语句表达
#define min_t (type, x, y) \
({ type __x = (x); type __y = (y); __x < __y ? __x: __y;})
int ia, ib, mini;
float fa, fb, minf;
mini = min_t ( int, ia, ib);
minf = min_f (float, fa, fb);
标准c:
#define min (x, y) ((x) < (y) ? (x) : (y))
代码min ( ++ia, ++ib) 被展开为 ((++ia) < (++ib) ? (++ia):(++ib)) ia,ib 被加了两次。
4 typeof
#define min(x, y) ( {\
const typeof(x) __x = (x); \
const typeof(y) __y = (y);\
(void) (&__x ==&__y); \
__x <_ _y ? __x : __y ;})
5 pr_debug 可防止在参数选项不代表任何参数的时候 不输出,。
6 可指定范围初始化数组 unsigned char data [MAX] = { [0 ... MAX - 2] = 0};
结构体成员初始化结构体:
struct file_operations ext2_file_operations =
{
llseek:generic_file_llseek,
read: generic_file_read,
}
同样,标准c:
struct file_operations ext2_file_opreations =
{
.llseek = generic_file_llseek,
.read = generic_file_read,
}
.....
相关文档:
参看www.pgsqldb.org网站上的文档/客户端编程
需要链接libpq库,应包含头文件include/libpq-fe.h
路径要看你具体将postgresql安装在哪里啦
给你一个具体例子吧(从www.pgsqldb.org上copy的)!!!
&nb ......
一、预备知识—程序的内存分配
一个由c/C++编译的程序占用的内存分为以下几个部分
1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。
2、堆区(heap) — 一般由程序员分配释放, 若程序员不释放,程 ......
windows7 + ubuntu9.10双启动,这个有太多的帖子了,不过这次的情况比较复杂.
先装的WIN7,后装UBUNTU,没有任何问题.GRUB双启动.
后来因为一个情况,要装XP,把WIN7做了 ghost.装完XP,GRUB当然没有了,于是用ubuntu启动盘修复.
虽然启动菜单出来了,但只能进行ubuntu,进入windows的时候就提示error:cannot get C/H/S value ......
网上有好多篇文章讲如何配置.vimrc文件来实现VIM里一键编译,看了一下比较复杂。我一般没有什么大的程序要写,一般的小程序单个C文件就搞掂了,所以简化了一下网上的配置,在.vimrc里加上两行就满足我的需求了。
set makeprg=gcc\ -Wall\ -o\ %<\ %
map <F7> :make<CR ......
As is Known to us,the function Main is the entry point of all programs.Therefore, we are usually neglecting all that we don't do,which makes us not understanding it more clearly.Now there is a sample arm program which will provide something that opration system usually do.
asm:
&nb ......