3 ms·
One file of 2600 lines, guess if you give up common sense and follow this approach you can even create a kernel in one file
by lnxg33k1 5y ago
One file of 2600 lines, guess if you give up common sense and follow this approach you can even create a kernel in one file
- mro_name 5y agohave you ever looked at the source of sqlite?
- littlecranky67 5y agoAFAIK FreeRTOS is a kernel and distributed as a single file.
- nneonneo 5y agoMaybe that was true at some point, but it’s no longer true. FreeRTOS consists of a core of 6-7 .c files (some of which may be optional) plus 2-3 board support source files. See their GitHub mirror: https://github.com/FreeRTOS/FreeRTOS-Kernel https://github.com/FreeRTOS/FreeRTOS-Kernel
- alex_smart 5y agoI am not sure exactly where you were trying to go with this, but 2600 lines is actually pretty short for a C program.
- Cthulhu_ 5y agoWhose common sense though? You seem to have one particular opinion on how to organize a project, but that's not the only one. Sometimes, having just one file is easier.
- mhd 5y agoFor parsing/protocol handling the implementations where this was distributed amongst several files and/or classes have usually been the worst, in my experience. But now I want to see how badly you could Uncle Bob this thing. My screen should be wide enough for the resulting function names.
- brobdingnagians 5y agoDepends on your development style and aims. One file is easy to add into a project, and the compiler optimizes translation units better, so you get a bit of a performance increase in some cases. Having "Find symbol in file" is nice too if you know you are looking for it just in this one file related to the code. Most editors aren't as ergonomic for finding "symbol in current directory" as they are for "symbol in current file".