老:
#if defined(__GNUC__)
#if __GNUC__ >= 3
#define CPINLINE inline __attribute__((always_inline))
#else
#define CPINLINE inline
#endif
#elif defined(_MSC_VER)
#define CPINLINE __forceinline
#else
#define CPINLINE inline
#endif
新:
#if defined(__GNUC__)
#if __GNUC__ >= 3
#define CPINLINE inline __attribute__((always_inline))
#endif
#else
#define CPINLINE inline
#endif
_MSC_VER:微软C版本,本次编译不涉及Windows系统,故不需要.
CPINLINE:声明函数为内联,即b()调用a()时,不会跳转到a()的内存地址,而是在b()中直接复制了一份儿a()的代码
inline __attribute__((always_inline)):强制内联
老:
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
#define MAP_ANONYMOUS MAP_ANON
#endif
新:
无
MAP_ANONYMOUS:用于mmap()的第4个参数,表示内存映射区不与任何文件关联.
MAP_ANON:MAP_ANONYMOUS的别名,已经被弃用.
老:
#ifndef SOCK_NONBLOCK
#define SOCK_NONBLOCK O_NONBLOCK
#endif
新:
无
O_NONBLOCK:非阻塞,非阻塞I/O使我们的操作要么立即返回成功,要么立即返回错误,不被阻塞.
使用方式有两种:
(1)调用open获得一个新描述符,并指定O_NONBLOCK标志.
(2)对已经打开的文件描述符,调用fcntl,打开O_NONBLOCK文件状态标志.例如:flags=fcntl(sock,F_GETFL,0));fcntl(sock,F_SETFL,flags|O_NONBLOCK);
老:
/**
* PHP5.2
*/
#ifndef PHP_FE_END
#define PHP_FE_END {NULL,NULL,NULL}
#endif
新:
无
老:
#ifdef PHP_WIN32
#define PHP_CONNECT_POOL_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
#define PHP_CONNECT_POOL_API __attribute__ ((visibility("default")))
#else
#define PHP_CONNECT_POOL_API
#endif
新:
#ifdef defined(__GNUC__) && __GNUC__ >= 4
#define PHP_CONNECT_POOL_API __attribute__ ((visibility("default")))
#else
#define PHP_CONNECT_POOL_API
#endif
把Windows相关的去掉了
__attribute__ ((visibility("default"))):控制函数符号表的导出,详见,http://liulixiaoyao.blog.51cto.com/1361095/814329/