for relatively small projects, a single main file that includes all necessary code might be preferable to makefiles, headers and separate objects.
the more common way is to compile parts of the application separately into machine code objects, maintain header files with declarations for each object and then use a linker to connect the code in object files. this may save time in the development of big projects when most objects have previously been compiled and only a few have changed and need to be recompiled.
further information: wikipedia article. sqlite uses a single compilation unit. the style is similar to javascript in html without module systems where all source files and dependencies are included at the beginning of an html file before use.
floor
is slowfile_buffer = mmap(0, file_size, PROT_READ, MAP_SHARED, file_descript, 0); MD5((unsigned char*) file_buffer, file_size, result); munmap(file_buffer, file_size);
[1 2 3 1 2 3] vs [[1 2 3] [1 2 3]]
flat
if not using standard type[][] arrays
nested
easier to access because sub arrays can be iterated with one incremented index and without having to incorporate the sub array size in the indexing calculation
easier to use with generic array operations, for example sorting
one array and every sub array has to be allocated separately and later freed
pro
con
used size and total allocated size can be tracked separately. the total length of active elements can be reduced but elements can also be added up to the allocated size, and the allocated size can be automatically expanded, for example with realloc.
pro
there are multiple options for when to do resizing
option
option
manual ensure-n before usage, which resizes if necessary
no free space checks when adding
trying to add more than what was allocated for may lead to buffer overflows
the biggest slowdown i have experienced when programming in c versus other languages comes from having to be more specific: