1. linux   int snprintf(char *restrict buf, size_t n, const char * restrict   format, ...);

   windows  int _snprintf(


2. 头文件都是string. h
 windows平台:函数:stricmp(char *str1, char *str2), strnicmp(char *str1, char *str2, size_t n).
Linux平台: 函数:strcasecmp(char *str1, char *str2), strncasecmp(char *str1, char *str2, size_t n).


3. linux环境下是:vsnprintf
    VC6环境下是:_vsnprintf
   AString.cpp  linux vasprintf()
    

  1. static int vasprintf(char **strp, const char *fmt, va_list va)  

  2. {  

  3.     const int required = vsnprintf(NULL, 0, fmt, va);  

  4.     char *const buffer = (char *) malloc(required + 1);  

  5.     const int ret = vsnprintf(buffer, required + 1, fmt, va);  

  6.     *strp = buffer;  

  7.     return ret;  

  8. }

   4. windows下winsock.h/winsock2.h
    linux下sys/socket.h    错误处理:errno.h


5. write windows头文件
  include unistd.h


6. socklen_t 
     windows 头文件 #include<ws2tcpip.h>
      linux   下头文件

      1)#include <sys/socket.h>
      2)#include <unistd.h>
7. _attribute__关键字主要是用来在函数或数据声明中设置其属性。给函数赋给属性的主要目的在于让编译器进行优化。函数声明中的__attribute__((noreturn)),就是告诉编译器这个函数不会返回给调用者,以便编译器在优化时去掉不必要的函数返回代码

    __attribute__((unused)) 告诉编译器这个函数可能不用,不需要报warning错误
8. __typeof__ 

   decltype是根据变量推导获取出变量的类型


9. GNU C的一大特色(却不被初学者所知)就是__attribute__机制。__attribute__可以设置函数属性(Function Attribute)、变量属性(Variable Attribute)和类型属性(Type Attribute)。

10.error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
这是因为在VC6中,若是没有显示的指定返回值类型,编译器将其视为默认整型。然则vs2005不支撑默认整型。
解决办法如下:

打开:项目----项目属性----设备属性----C/C++----号令行,在附加选项那边添加/wd4430这个选项


11. windows socket头文件的错误

正确引用顺序

//#include <winsock.h>

#include<Winsock2.h>

#include <ws2tcpip.h>


12. 原子操作

   windows InterlockedXXXX
   C++11  atomic_fetch_add_explicit


13. 

class Node{


private:

friend class List;

friend class _ListIterator;

}

  template<typename U,template <class> class Constness>

    class _ListIterator {

        typedef _ListIterator<U, Constness>     _Iter;

        typedef typename Constness<U>::NodePtr  _NodePtr;

        typedef typename Constness<U>::Type     _Type;


C2990  非类模板声明为类模板


解决: 


friend class List;

template <class V>

friend class _ListIterator;



14

    if (m_ptr)

        m_ptr->incStrong(this);


C2027  使用了未定义类型“android::RTSPMirroringSource::PlaybackSession::Track”   FSV4   c:\users\lindt.scrc\desktop\all-compile-fsv5\all-compile-fsv4\fsv4\utils\strongpointer.h    124

C2227  左边必须指向类/结构/联合/泛型

 

VC里面需要定义完struct后才允许使用

Struck Track;
例如KeyedVector<size_t,sp< Track> > mTracks;