Re: Studying C programming
Posted: Mon Sep 05, 2016 4:21 pm
This is no "stupid legwork" for me. We only need to create a few different executable skeletons, so it's much more lightweight than using exclusively pre-built binary-generation utilties without ever getting involved in how things work. I cannot expect to call myself, let alone properly function as a system programmer if I don't even know how the executables are built and loaded without the help of a third-party tool.Kevin wrote:Is the keyword that you're looking for Link Time Optimisation (LTO)? Or what other kind of optimisation are you thinking of?~ wrote:Why are we using binary-mode libraries and references instead of optimizing by using text-mode libraries/applications and produce binary-mode files?
Essentially for the same reason why we write in a high-level language rather than assembly if we can, or we use an assembler rather than a hexeditor in order to create binaries at least. It's something that the machine is perfectly able to generate, which saves me time and avoids mistakes.Why are we using binary-mode-only executable header generation intermixed (inefficiently at least at system-level programming) with text-mode-only sources, when their format looks trivial and very cheap (just like casual hand-made databases written before Fox Pro for DOS) when converted to C or assembly code, but becomes very confusing if only the tool-chain ever produces them for making for a more ignorant programmer?
I very much prefer working on actually creative tasks rather than doing stupid legwork that the computer could be doing for me.
I need real portability. Being a single person who needs things be written and work most of the time for years (why not script and trivialize compiled languages not by automating the build process but by increasing the knowledge and full code resources on how things work without only ever using binary-blob header stubs?) I cannot afford to leave my code trapped to just a past version of a Linux distro or toolchain. Have you seen how the bigger a project is the more things it needs to detect from a system and how there are old and useful programs that cannot be compiled or run in a practical way unless an old machine with an older Linux distro is used? I don't want to dramatically update and having to modify my code and linking scripts just to keep being able to compile my OS without errors or strange bugs under newer distros. It defeats any portability that the application-level code could have if it gets stalled in having to use specific external compiler/linker/library versions.
I cannot afford that to happen, so I need to build real code portability which doesn't depend on the libraries installed on a system nor in the toolchain, but in producing proper executable structures (after building many executables). Plus, I need that knowledge for things like being able to load drivers from CD installation disks, under DOS or under my own OS (what I mean is loading the Windows drivers for 9x or NT that come in the original CDs in other OS, so I need to know all about the executable format to implement that driver layer).
Anything that you don't know and get to learn is actually a creative work, specially if you need to discover and learn the most basic functions and structures of a system. From there more creative and original work can be done, but if we just use the executables that the compiler/linker make we are actually being much less creative. Also, those sort of executables will never stop compiling and running properly, and then we will also be able to take our creative work to many more platforms than if we didn't know how to build an executable by hand (a simple casual-database-like piece of code to write in C or assembly that will become familiar after a few compiles and studying iterations).
C needs more fundamental structures and library functions that we can easily hand-pick,copy and paste instead of just including header files and stub/header binary blobs. Do you see how only using generated executables is the same than copying and pasting source code without understanding it, just that here we are copy/pasting binary blobs?
Assembly needs more automatic-sized instructions and data types built into the language itself. It's a very easy to update language for Intel/AMD.
With that, they all (C and assembly, and even C++ with hand-picked library code for the C++ run-time) will become dramatically similar and exchangeable.