Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
For a library, I'd first figure out what you can call and what it is supposed to achieve, going by the names. Then the input parameters, what are they, what data types, what valid range. Same for possible outputs. Figure out how to check for success, can be error codes or output variables set to invalid range. Or maybe you have to provide a callback function.
Oh, and maybe there is some sort of init logic that you have to call first. Should be something with init, reset, setup or similar.
When diving into the code, I go top-down and understand the main logic, marking the helper calltree as "hopefully works as intended, will check later".
It's easiest if you have an example project, or another project that uses the same thing so that you can use that as template. -
Orionss28986y@Fast-Nop since Rofi is in C code and is using XCB and Coira (and it's not library), without the doc I finally found in header files, I couldn't have read the code. How do you deal with near-to-system C code in particular? snake_case names without having the right vocabulary and C code is very indigest...
-
@Orionss well I write C code on system level, though I strive at least for proper names and comments.
In that case, I'd still go top down. For a program of its own, that would be starting with main() and see what's going on there. Otherwise, there must be some entry point somewhere.
Related Rants
I would like to understand xcb library by looking at the rofi (dmenu replacement) source code but there is no code documentation. How do you guys deal with non-documented source code (supposed to be easy)
question
documentation
open-source
rofi