-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Dec 16, 2006 at 04:55:48PM +0530, Naveen Kumar wrote:
> Hi all,
> 
> I am using an hand held device running on montavista linux,
> 1) i wrote a c program 
> 
>      int main ()
>        {
>          int i;

i is uninitialized here. It contains a random value...

>          while (i < 25000)
>          printf ("%d\n", i);

...which doesn't change at all while the loop is running.

>        }
> it works very fine in my machine without any problem. (it takes around 1.2
> minutes)

So I don't understand why this program terminates at all (it should
terminate either *immediately* or *never at all*.

> 2)If try to run the same part of code on a button click using gtk,
> the application is crashing around 30 seconds saying just "Terminated".

Even 30 seconds seem too long (or too short, depending on the initial
value of i).

BTW, if you compile that with -Wall, the compiler would have told you
that (needs option -O as well):

 | [EMAIL PROTECTED]:~$ cat fo.c
 | #include <stdio.h>
 | 
 | int main ()
 | {
 |   int i;
 |   while (i < 25000)
 |   printf ("%d\n", i);
 | }
 | [EMAIL PROTECTED]:~$ gcc -O -Wall -o fo fo.c
 | fo.c: In function 'main':
 | fo.c:7: warning: 'i' is used uninitialized in this function
 | fo.c:8: warning: control reaches end of non-void function

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFhNT4Bcgs9XrR2kYRAnr6AJoCjUAlBxcSFTZ1LTrscfh25YH76QCeIy5U
5nV+H8AO+bgUgSWQ8r69tS0=
=20kT
-----END PGP SIGNATURE-----

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to