[TriLUG] what do crt[1in].o do?

Rodney Radford rradford at mindspring.com
Wed Dec 9 18:09:36 EST 2009



>I tried strace on the executable that didn't run in my first 
>posting and all it gave was "execv: cannot find file"

Yes, I was suggesting you run it on one that did compile properly.  For a very simple C program, just use "gcc main.c -o main" to generate the program and then strace it.

>> And may I ask why you are curious?
>I'm teaching C and I don't know much about it :-(

First, I applaud you for wanting to learn the details, and even more so for volunteering to teach programming.

However, I do not think that teaching them the internals of the GCC compiler is very helpful, any more so than teaching the internals of the internal combustion engine to a kid wanting to learn how to drive.  All they need to know is the external buttons, knobs and levers to push to do the work, and assume the car works as designed. Later, if they decide to be an automotive technician, or engineer, etc, then they can learn the internals.

The same is true of GCC - very few people need to know how it works internally. It is nice to know, it is fun to know, but I would not consider it useful to writing most of the programs I write in my life. The only time it really matters what happens under the cover is when you need to do something outside of the C standard and usually that is because you are running on bizarre hardware or unusual constraints.

In fact, I doubt that most graduating computer science majors can even explain what happens internally for GCC, and they don't care. And even if they did care, it varies with different compilers and different architectures.

Concentrate on teaching them how to write good C and there are several good resources out there for that. 

Good luck and I will be glad to help you in your quest for internal details of GCC (which is a different subject than how to program in C).

Thanx,
Rodney




More information about the TriLUG mailing list