[comp.lang.c] My posting

gtchen@faline.bellcore.com (George T. Chen) (09/17/87)

In article <> smvorkoetter@watmum.waterloo.edu (Stefan M. Vorkoetter) writes:
>From where did you get this piece of information? Char is always widened to
>int, and float to double, but never int to long.

... as well as many other people ... but anyway this has very little
to do with my original posting.  Let me try to recap it.  In Turbo-C,
I had two identical programs except for the following:

1st prog:  main()
	   {   ... some declaration ...
	       long number;
               routine(&number);
	       printf("%ld",number);
	   }

2nd prog:  main()
	   {   ... same declaration ...
               long random,number;
               random = 0;
               routine(&number);
               printf("%ld",number);
           }

The subroutine 'routine' is identical in both.  The second program
returns the correct value of number.  The first program zeros out the
least siginificant byte of number.  'random = 0;' is included so
that the compiler allocates memory for it instead of ignoring it.

Anyone care to explain?

	


-- 
+-----------------------------------------------------------------------------+
|What's a .signature? Life is an equation whose only solutions are irrational |
|gtchen@thumper.bellcore.com ! gtchen@romeo.caltech.edu ! gtchen@where.am.i?. |
+-----------------------------------------------------------------------------+