C without stdio, what is possible?

For some time I was interested in programming the operating system. When sharing through several different sites, I came across an interesting concept (to rephrase): if you start writing your C # include loader, you already made a fatal mistake.

I went through K&R and the whole book includes it in every lesson. Using it while learning C, I don’t know what I learned using stdio and what not. What can you do in C without stdio?

+5
source share
6 answers

Standard C (ISO / IEC 9899: 1999) recognizes two types of implementation (§4 Compliance, ¶6):

  • Freestanding - ( ) :

    <float.h>
    <iso646.h>
    <limits.h>
    <stdarg.h>
    <stdbool.h>
    <stddef.h>
    <stdint.h>
    

    ( <stdarg.h> ). , .

  • Hosted - , .

, , ​​, -. , , - , . , main.

, , - . ( ), , , C, .

+4

stdio /. , , IO. Wikipedia stdio.h stdio.h. stdio.h, . stdio.h .

, - , , . , , , . UNIX - . Nachos . . , . , , , .

+1

#include, . , , , , . C. C. ( ..).

stdio - , , . stdin, stdout, stderr . , . - , , , , , . stdio .

stdio read() write(). , stdio, printf(), fprintf(), fgets() .. , , - , , , .

: - C stdio. C , , C.

+1

C , .

C " ", , , . , -, -, -, volatile.

stdio C, , -. volatile , "". volatile, C, , , . CPU, , ( ), -, ..

, , ( : , , , ). , , . , C.

+1

Wikipedia , stdio.h.

, stdio.h, , , . , , . , scanf() BIOS.

. , API . , .

0

C stdio, ?

. stdio.h - , . : stdio.h . -//.

#include, .

, . #include / , .

. , stdio.h.

More importantly, if you write the loader in a compiler designed for a specific OS (Windows, Linux, etc.), the compiler will call the OS API calls from these library functions. And since the OS API will not be present at boot time, all such function calls will fail. How to implement the bootloader is highly dependent on which system you have. Perhaps you could clarify if this is suitable for a PC or something else?

0
source

All Articles