How to use Doxygen to document local variables within C++ functions

后端 未结 2 1329
盖世英雄少女心
盖世英雄少女心 2021-01-06 08:41

For example, in my function

//starting code with doxygen documentation
/** The main function. I will now try to document variables within this main function*         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-06 08:56

    While you can put comments in the body of a function and let them appear as part of the function documentation like so

    /** @file */
    
    /** The main function. I will now try to document 
     *  variables within this main function.
     */
    int main()
    {
      /** an integer array. */
      int arr[];
    
      /** An endless loop */
      for (;;) {}
    
      return 0;
    }
    

    This is generally not recommended as others already pointed out. If you want (as a developer) to read the sources along with the documentation, you can better use normal C comments in the body

    /** @file */
    
    /** The main function. I will now try to document 
     *  variables within this main function.
     */
    int main()
    {
      /* an integer array. */
      int arr[];
    
      /* An endless loop */
      for (;;) {}
    
      return 0;
    }
    

    along with setting INLINE_SOURCES to YES.

提交回复
热议问题