Question: Copy uninit.c , look at the code. Compile with gcc , run it a few times. Do the same with tcc , Q 1 What

Copy uninit.c, look at the code. Compile with gcc, run it a few times. Do the same with tcc,
Q1 What did you observe? What did you expect?
The code for uninit.c is below:
uninit - check to see which compilers do what with
+unitialised variables
OCT 2020
*/
#include x%f?
ix%f?
,quad i,x
Compile sphere.c with gcc:
$ gcc sphere.c -o sphere
Now compile sphere-pow.c with gcc:
$ gcc sphere-pow.c -o sphere
/tmp/ccj8YBDC.o: In function 'main':
sphere-pow.c:(.text+0x9e): undefined reference to 'pow'
collect2: error: ld returned 1 exit status
This is a linker error, not a compiler error.
Doesn't refer to a line #
Mentions an object (.o) file (this is a temporary one)
o It tells you so: "ld [the linker] returned..."
$ gcc sphere-pow.c -o sphere -1m
To be faster, tcc doesn't call ld; it does the linking itself. tcc won't find atan without help:
$ tcc sphere-pow.c -o sphere -1m
Copy uninit.c, look at the code. Compile with gcc, run it a few times. Do the same with tcc,
Q1 What did you observe? What did you expect?
In short, do not rely on default values. Initialise your variables.you expect?
 Copy uninit.c, look at the code. Compile with gcc, run it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!