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
Q 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
#include
quad
Compile sphere.c with gcc:
$ gcc sphere.c o sphere
Now compile spherepow.c with gcc:
$ gcc spherepow.c o sphere
tmpccjYBDCo: In function 'main':
spherepow.c:textxe: undefined reference to 'pow'
collect: error: ld returned 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 spherepow.c o sphere m
To be faster, tcc doesn't call ld; it does the linking itself. tcc won't find atan without help:
$ tcc spherepow.c o sphere m
Copy uninit.c look at the code. Compile with gcc run it a few times. Do the same with tcc
Q What did you observe? What did you expect?
In short, do not rely on default values. Initialise your variables.you expect?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
