Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on
Question C code compilation
- 07-28-2003
July 28, 2003, 12:30 am

Hi All,
I wrote simple program to print "Hi how are you" 100,000 times and
compiled on Redhat Linux.
test.c
main()
{
printf("Hi How are you");
.
.
.
/*Repeated printf for more one hundread thousand times */
}
then
did #make test
cc test.c -o test
this command did NOT exit for more than half hour, later I did
control-c to exit.
Please tell me why I can't compile this long code?, what would be the
best approach other than splitting the code.
thanks
kishuri
I wrote simple program to print "Hi how are you" 100,000 times and
compiled on Redhat Linux.
test.c
main()
{
printf("Hi How are you");
.
.
.
/*Repeated printf for more one hundread thousand times */
}
then
did #make test
cc test.c -o test
this command did NOT exit for more than half hour, later I did
control-c to exit.
Please tell me why I can't compile this long code?, what would be the
best approach other than splitting the code.
thanks
kishuri

Re: Question C code compilation

I know your embedded world is different. However, every embedded
systems do need a compiler and an operating system. This Question
falls under these two sections of embedded systems. Are not there any
better way to generate code, why does it fail or take longer when
compiling huge function like here main()? How long your embedded OS
take to compile this. If fails, how can you fix it? Think over it
before questioning others.
thanks,
kishuri

Re: Question C code compilation
snipped-for-privacy@Watt.COM (Steve Watt) writes:

Actually this is an indication of extreme low resources on the
development host. I just tested this on a standard PC running Linux:
bash$ time gcc -o foo foo.c
real 0m13.948s
user 0m12.880s
sys 0m0.230s
As you can see, it took just 14 seconds to compile your program.
And this is no high-end machine at all. It's a standard AMD XP
processor at 2083 MHz with 512 MB RAM.

I have not the slightest idea where you get such a number from. To
build a medium-sized project (U-Boot) with some 350k+ lines of C code
(_not_ counting the header and assembler files) takes less than 20
seconds on an even slower machine (AMD Athlon at 1400 Mhz).
Your number is approx. 600 times too big!
Wolfgang Denk

Actually this is an indication of extreme low resources on the
development host. I just tested this on a standard PC running Linux:
bash$ time gcc -o foo foo.c
real 0m13.948s
user 0m12.880s
sys 0m0.230s
As you can see, it took just 14 seconds to compile your program.
And this is no high-end machine at all. It's a standard AMD XP
processor at 2083 MHz with 512 MB RAM.

I have not the slightest idea where you get such a number from. To
build a medium-sized project (U-Boot) with some 350k+ lines of C code
(_not_ counting the header and assembler files) takes less than 20
seconds on an even slower machine (AMD Athlon at 1400 Mhz).
Your number is approx. 600 times too big!
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Web: www.denx.de
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Web: www.denx.de
We've slightly trimmed the long signature. Click to see the full one.
Site Timeline
- » How to check the dependence with kernel and glibc
- — Next thread in » Embedded Linux
-
- » [News] IBM toolkit targets "multimodal" apps to Sharp Zaurus 5600
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Miernik energii potrzebny, taki domowy
- — The site's Newest Thread. Posted in » Electronics (Polish)
-
- » ESR "больших" конденсаторов
- — The site's Last Updated Thread. Posted in » Electronic Circuits (Russian)
-