• C & C++ 中值得注意的编译,链接,调试,错误及其原因


    1.    #define VaParameter_Macro(...) 
           编译环境: VC6.0
           编译错误:  error C2010: '.' : unexpected in macro formal parameter list
            原因:   据查是因为VC6.0不支持可变参数的宏定义,VC6.0编译不能通过
     
     

    2. ****.cpp 文件中有如下函数:

     

    void skf_drawText(Skf_Char* pcText, Skf_S16 x, Skf_S16 y, screenRectSt rect, colourSt colorst, Skf_S32 flag, Skf_U16 font, unsigned    char  **p) 

    其中: 

    struct screenRectSt ;

    struct colourSt 自定义数据结构

     

    通过gdb调试,进入skf_drawText, 所有的数据均为非法数据,无法进行调试,但print的数据均为正常,有效数据

    如下所示:

      通过尝试用如下定义,则调试过程一切正常。

      void skf_drawText(Skf_Char* pcText, Skf_S16 x, Skf_S16 y, mr_screenRectSt* rect, mr_colourSt* colorst, Skf_S32 flag, Skf_U16 font,    unsigned char  **p) 

    结论: 函数定义,实现过程中,参数尽量采用指针或者基本数据类型,提高效率同时 方便gdb 进行调试 
  • 相关阅读:
    [bzoj4364] [IOI2014]wall砖墙
    [bzoj3064] [Tyvj 1518] CPU监控
    [bzoj3434] [WC2014]时空穿梭
    ASP.NET
    ASP.NET
    ASP.NET
    ASP.NET
    ASP.NET
    ASP.NET
    MSSQL
  • 原文地址:https://www.cnblogs.com/yaozhongxiao/p/2383966.html
Copyright © 2020-2023  润新知