See below.
On Mon, 15 Jun 1998, Andrea Arcangeli wrote:
>
> You could write also:
>
> void main(void)
> {
> float r = '0';
> printf("%f\n", r);
> }
>
> And '0' will be casted to float and it will print 48.000... as expected.
>
> Andrea[s] Arcangeli
>
>
Yes, C has been fixed so that it works almost in spite of the
programmer. Depends on which compiler you use.
But defining r to be float and then initializing it as char will
give un-expected results. It is bad code and is only good if it does what
you want it too...:-)
I think here in the C programmer sig we should try to use only
clear programing examples. Not litter the thing with trivial code that
works but is not supposed to.
Best wishes
- Karl F. Larsen, 3310 East Street, Las Cruces,NM (505) 524-3303 -
- -ffloat-store bug in all version of gcc - needed help ... Andrea Arcangeli
- Re: -ffloat-store bug in all version of gcc - nee... Glynn Clements
- Re: -ffloat-store bug in all version of gcc -... Andrea Arcangeli
- Re: -ffloat-store bug in all version of g... Glynn Clements
- Re: -ffloat-store bug in all version of gcc -... MCENANEY WILLIAM J
- Re: -ffloat-store bug in all version of g... Glynn Clements
- Re: -ffloat-store bug in all version ... Andrea Arcangeli
- Re: -ffloat-store bug in all version of g... Karl F. Larsen
- Re: -ffloat-store bug in all version of gcc - nee... Bryan Scaringe
- Re: -ffloat-store bug in all version of gcc -... Andrea Arcangeli
- Re: -ffloat-store bug in all version of g... Karl F. Larsen
- Re: -ffloat-store bug in all version of gcc -... Karl F. Larsen
- Re: -ffloat-store bug in all version of gcc - nee... Nabil EL ANDALOUSSI
