this post was submitted on 31 Aug 2023
49 points (98.0% liked)

Programming

17031 readers
244 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 4 points 1 year ago (1 children)

I'd argue that's not true. That's what the extern keyword is for. If you do #include , you don't get the actual printf function defined by the preprocessor. You just get an extern declaration (though extern is optional for function signatures). The preprocessed source code that is fed to cc is still not complete, and cannot be used until it is linked to an object file that defines printf. So really, the unnamed "C preprocessor output language" can access functions or values from elsewhere.

[โ€“] [email protected] 1 points 1 year ago

No, it can't. The compiler can't do anything with content from any file not explicitly passed to it. You're mixing up the compiler and the linker (and the linker has nothing to do with either language, it can link binaries compiled from any language).