Hi everyone, I just started C and I'm trying to understand some conceptual things. If anyone can help me with any of my questions It would be appreciated! I just want to hear it from something other than a book.

1. So, if macros can hold arguments, why would you do whatever computation in the macro if you could just as easily make a function?

2. What are Pragmas? as in #pragma <text>

3. How do I define a simple preprocessor macro that swaps three variables

4. What is a Link Editor? I know it takes .o and .a files and creates an executable, but why does it do that? What would be an application for that?

5. Where do all the function libraries come from? Did someone just create them and give them away?

>5. Where do all the function libraries come from?
From the supermarket like potatoes and hamburger meat. Everyone does know that, doesn't it?

>Did someone just create them and give them away?
Nope, "The Library of Congress" issues license every year for the public to use those libraries, that's why you need to use the "Link Editor", which it checks that you have the right license in your program.

>5. Where do all the function libraries come from? Did someone just create them and give them away?

Now a bit more serious.
What most people call compiler comes with a set of libraries, which are pieces of software in binary code. Of course someone needed to write and compile that code before hand.
You can find compiler/linker/libraries done by programmers, that do not mind to release to the public, all this work for no monetary compensation. But certainly, there are plenty of compiler/linker/libraries in the market for purchase. And what do you buy? The right to use it.

"Link Editor" might be the name of a software program that do something completely different that what the linker in compiling is suppose to do.

>

>Did someone just create them and give them away?
Nope, "The Library of Congress" issues license every year for the public to use those libraries, that's why you need to use the "Link Editor", which it checks that you have the right license in your program.

What do you mean to the public, like software companies, or individual people? Do they have to pay?

What do you mean to the public, like software companies, or individual people? Do they have to pay?

I was joking lemichelle. Hopefully my second post clears that.


Compiler, linker and library are three distinctive concepts. At times people referrers to them as a group with the loose term of compiler. The compiler mission is to make those written human code into binary code. The libraries are pieces of binary code which do some specify work, and the linker mission is to join all this together with the program you want to create.

This question has already been answered. Start a new discussion instead.