Go Back   Computer Forums > General Computing > Programming
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 11-28-2006, 09:10 AM   #1
Solid State Member
Join Date: Sep 2006
Posts: 14
Lightbulb About c compilers ......

OK i can do a little bit of C programming and i think i am relatively good at it.
But yet i don't understand some of the very basic things well enough.
1 of them will be about c and its compilers.
If somebody can - please help.
here are my questions:

1> C is a middle level language since it has features of both a high level language and
low level languages.Does compilers work differently for different levels of abstraction
present in a language?

2>what kind of languages are used to create operating systems.How does compiler fit with
an operatimg system?

3>Since the hardware for every machine is diferent, a compiler then must
take into account the machine architecture.So how does a compiler do it?
Does the creator of the compiler manually tell the compiler about the hardware or does the
compiler itself interacts with the machine and figures out its H/W?

4>can i download copilers?
if so can i use 2 compilers for the same programming language in a machine?

5>how are compilers created?just a basic overview please

6>i am interested in the c language,i have heard that a lot of games are created using c/c++.
but then games use sound and graphics.What are library files that contain graphic functions?

Any help will be greatly appreciated .thanks.
Also, please refer to the numbering so that it becomes easy for me to understand.

singularity0 is offline   Reply With Quote
Old 11-29-2006, 10:04 PM   #2
Fully Optimized
troy's Avatar
Join Date: Jul 2006
Location: USA
Posts: 2,410
Default Re: About c compilers ......

I have an answer for number 4.

4> yest you can use two compilers for the same programming language in a machine. My computer currently has 3 java IDE/compilers programs on it. I know nothing about the C programming language but I'm guessing you should be able to do two compilers at once. Of course someone else might know more about this but I'm pretty sure it should work with C.

Desktop: Dell Dimension E510, 2.5GB RAM, Intel P4 3.0GHZ, 250GB HDD, Windows Vista Premium. Might not be the best, but the old girl is still running good.
troy is offline   Reply With Quote
Old 11-30-2006, 01:34 PM   #3
Baseband Member
Griz803's Avatar
Join Date: Jun 2004
Posts: 89
Default Re: About c compilers ......

Okay, here we go into some debatable territory. Here's what I know as well as a bit of opinion.

1> "C is a middle level language" Well, that's one way of looking at it. It is actually only higher than assembler and machine code itself, which really isn't as "middle" today as it once was, though most authorities place it as a third generation language. Third generation is exactly middle. The issue that I raise is simply that the C language exists with few keywords, including those that most forget actually manipulate the registers in the processor directly. And the asm keyword that allows the compiler to send in an assembler to create inlined assembler routines. That doesn't sound all that middle. And the contradiction to that is the extensible and ANSI standard routines that we all use from the C language's libraries everyday. Those make it feel more like a higher level language, IMHO. Short answer to the last part: YES. Any difference in two compilers isn't really a surprise if you look at the intricacies of compiler construction. Take a look at this to see what I'm talking about in excruciating detail: http://www.etek.chalmers.se/~e8johan/compiler/

2> Compilers or assemblers that can be created to run on other pre-existing platforms are essential to create a new operating system. In the case of Unix and Linux, a good deal was done in C. Only a few things like a boot loader and some low level file system services used assembler, I believe. I'm not at all certain that one couldn't write an OS using only C, if allowed to use the inline assembler command freely. Any language's compiler fits with a platform by being capable of processing source code into native binary that can be linked to any needed internal (platform specific) header information that the OS will use to load the program into memory, begin its execution and regain control when it exits.

3> As stated very briefly above, compilers and attendant utilities such as linkers, are written like any other software to fit the OS and hardware to some extent. The OS is the piece of software that will operate in conjunction with the BIOS (another program in the guise of firmware!) to initialize all hardware and create standard ways for all peripherial hardware to communicate with programs using the OS's services as an interpreter if needed. That's just what an OS is there for to begin with, not to make the desktop look pretty. Some of the earliest OSes were really, *REALLY* ugly, I promise.

4> Yes, and legally for free. A bunch of them can be found at:

5> I believe I already gave you one URL for this... but, it is a process of writing a piece of software that reads one file, looks for known landmarks in it (known as a parser, incidentally!), replaces certain things with known structures in another file and keeps track of all of it as it writes out the new object file.

6> Snooping around at http://www.thefreecountry.com will likely yield several good freeware libraries for C. Also, should you use the Dev-C++ IDE with the MinGW compiler (it handles C also, as do most C++ compilers), it has a live update tool that allows you to download libraries for it and install them from inside the IDE(Integrated Development Environment). You may want to check out the Allegro libraries and their various additions.

Good luck and Good programming!
/*What does not kill us, makes us drink far too much caffeine*/
Griz803 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 10:13 PM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0