Hello World

static 静态局部变量

1、例子

int a(){  static buff[1024] ;}

int b(){  static buff[1024] ;}

int c(){  static buff[1024] ;}

会分配三次buff的内存,至于在程序静态数据区域的名字可能是buff1,buff2,buff3 这三个指针,这个编译器有相应的规则定义!

2、 静态数据 在多线是使用时  是有问题的,因为 同进程下多线程的数据是共享的,所以 不同线程 可以 访问 统一进程下的 静态 变量!

多进程 怎没有这个问题!

posted @ 2011-04-01 17:16  Christina_Joe  阅读(206)  评论(0编辑  收藏  举报
Hello World