SRTF
SRTF

Reputation: 25

C functions definition

Recently I was studying the book The C Programming Language and in the first chapter I came across this paragraph

Function definitions can appear in any order, and in one source file or several, although no function can be split between files. If the source program appears in several files, you may have to say more to compile and load it than if it all appears in one, but that is an operating system matter, not a language attribute.

I have understood the part where it is saying that order of function within program does not matter. Can anyone explain the rest of it?

Upvotes: 0

Views: 107

Answers (2)

SuibianP
SuibianP

Reputation: 129

The C standard only dictates that a conforming implementation shall allow for separated compilation (several files). However, exactly how to compile and link is outside the scope of the language specification and depends on the actual implementation. For example, MSVC may require very different arguments from GCC while both are conforming implementations.

Upvotes: 1

ridale
ridale

Reputation: 166

The quick answer is that the C standard does not care about compiler and linker details.

So the C standard doesn't care about how you load libraries or how you use Makefiles or any of the other details of writing a non trivial program in C.

That is mainly due to the fact that C is often used with custom toolchains for embedded systems programming.

Upvotes: 0

Related Questions