* Craig Dickson ([EMAIL PROTECTED]) spake thusly: ... > (2) Is there any essential difference between the following two > declarations: > > double f = 4; > double f = 4.0; > > such that a conforming C compiler is prohibited from compiling them ^^^^^^^^^^ ^^^^^^^^^^ > to identical object code?
Sorry, Craig, WTF cares what "a conforming" compiler is "not prohibited" to do? The question is "is my 'now even more standards-compliant than ever' compiler *guaranteed* to *always* compile that to identical object code?" AFAICT float f = 4.0; tells the compiler to assign floating-point value of 4.0 to f. float f = 4; tells it to take integer value of 4, make a float out of it, and assign the result to f. Your compiler may do it right, and your code may never be compiled with another compiler. Unfortunately, "may" != "always will". My point, which you seem to have missed, was "given the choice between explicitly specifying something and trusting the compiler to do the right thing, always choose the former". That 4.0000000001234 crap was just an example off the top of my head -- sorry if it confused you. Dima -- E-mail dmaziuk at bmrb dot wisc dot edu (@work) or at crosswinds dot net (@home) http://www.bmrb.wisc.edu/descript/gpgkey.dmaziuk.ascii -- GnuPG 1.0.4 public key Q276304 - Error Message: Your Password Must Be at Least 18770 Characters and Cannot Repeat Any of Your Previous 30689 Passwords -- RISKS 21.37