api documentation and “value limits”: do they match?

前端 未结 5 1985
粉色の甜心
粉色の甜心 2020-12-07 02:25

Do you often see in API documentation (as in \'javadoc of public functions\' for example) the description of \"value limits\" as well as the classic documentation ?

5条回答
  •  囚心锁ツ
    2020-12-07 03:03

    I think they do, and have always placed comments in the header files (c++) arcordingly.

    In addition to valid input/output/return comments, I also note which exceptions are likly to be thrown by the function (since I often want to use the return value for...well returning a value, I prefer exceptions over error codes)

    //File:
    // Should be a path to the teexture file to load, if it is not a full path (eg "c:\example.png") it will attempt to find the file usign the paths provided by the DataSearchPath list
    //Return: The pointer to a Texture instance is returned, in the event of an error, an exception is thrown. When you are finished with the texture you chould call the Free() method.
    //Exceptions:
    //except::FileNotFound
    //except::InvalidFile
    //except::InvalidParams
    //except::CreationFailed
    Texture *GetTexture(const std::string &File);
    

提交回复
热议问题