r/C_Programming • • Oct 16 '26

Question Why not specifying what to include ?

Hi, sorry if there is English mistake, it's not my first language.

I found online that the #include is replaced by preprocessor by the whole file being included, and I wondered why C isn't made so we can specify only parts of the files to include (like `import { x, y, z } from "file"` in typescript) so the compiled file is lighter ?

19 Upvotes

28 comments sorted by

View all comments

1

u/septum-funk Oct 19 '26

you're basically doing that, that's what the header is doing by writing types and function signatures. registering something that will be used and defined elsewhere. if you only need to include specific things ya write a smaller header lol