Help with decrypting extra output and suggestion for a guide

I am very new to all things C. Eg. programming. compilers debuggers and such. So I am not the best candidate for development, but I like to experiment. And here is my first attempt to use clang with my test file (tfile.c). There is a lot more output then your webpage showed; that I do not understand or know about. I have read most of your website, yet I have not discovered what a lot of it means. Maybe just my lack of knowledge of all things compilers.

So is there a good book or website/s I can read to get this knowledge?

I have been reading “An Introduction to GCC - for the GNU Compilers gcc and g++” by Brian Gough, which I have found a good start point for programming with a compiler. Might be a good candidate for a rewritten for clang for newbies like me :slight_smile:

Yet this book does not has the intermediate to advanced knowledge that I am needing or wanting. I have also been reading the GCC documentation but it seems too be a more formal explanation of the compiler and tools. Not that many examples and good explanations of why or when to use some argument or option. For example they use -Wall argument to set a whole list of other arguments for warnings, but from my experiments your compiler (clang) does not. Is this true or am I wrong?

Seeking more input, Thanks
DMG

tfile.c (2.99 KB)

Yet this book does not has the intermediate to advanced knowledge that I am needing or wanting. I have also been reading the GCC documentation but it seems too be a more formal explanation of the compiler and tools. Not that many examples and good explanations of why or when to use some argument or option. For example they use -Wall argument to set a whole list of other arguments for warnings, but from my experiments your compiler (clang) does not. Is this true or am I wrong?

-Wall enables most warnings in Clang, just as it does in GCC.

Preprocessing:
Extra output shown what does it mean?

These are GCC-style shorthand line directives. They are used so that error messages from a preprocessed file still point to the correct files and lines in the original file. For example,
#1 "tfile.c"
means "line 1 of tfile.c starts here".

Output after bad commandline argument!!!!
clang -fsyntax tfile.c

Strange, that should at least warn that the argument is unused.

Type checking
No Output for both commands is this right?

Yes. If there is nothing wrong with the files, -fsyntax-only doesn't output anything.

Code generation with llvm:
Lots of extra output. What did it means and were can I find the information about it?

That's LLVM IR in text form.
http://llvm.org/docs/LangRef.html

More extra output, same again. Is this a elf file format or assembly sections with extra parts. Where can I get info?

That's x86 assembly in AT&T syntax, as *nix linkers accept it.

Summary: How much do you know about the process of compiling in general? Maybe you should get a book on compilers if you're interested in that topic. And I don't mean an internals/usage book for a specific compiler, I mean a general book on compilers such as this one:
http://www.amazon.com/Compilers-Principles-Techniques-Alfred-Aho/dp/0201100886

Sebastian