What can you do in C without “std” includes? Are they part of “C,” or just libraries?

后端 未结 11 1010
孤独总比滥情好
孤独总比滥情好 2021-02-02 06:11

I apologize if this is a subjective or repeated question. It\'s sort of awkward to search for, so I wasn\'t sure what terms to include.

What I\'d like to know is what th

11条回答
  •  长情又很酷
    2021-02-02 06:51

    What could you do? Everything!

    There is no magic in C, except perhaps the preprocessor.

    The hardest, perhaps is to write putchar - as that is platform dependent I/O.

    It's a good undergrad exercise to create your own version of varargs and once you've got that, do your own version of vaprintf, then printf and sprintf.

    I did all of then on a Macintosh in 1986 when I wasn't happy with the stdio routines that were provided with Lightspeed C - wrote my own window handler with win_putchar, win_printf, in_getchar, and win_scanf.

    This whole process is called bootstrapping and it can be one of the most gratifying experiences in coding - working with a basic design that makes a fair amount of practical sense.

提交回复
热议问题