|
From: Ioannis V. <no...@ho...> - 2002-06-09 03:17:31
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of rchavez > Sent: Sunday, June 09, 2002 5:23 AM > To: dev...@li... > Subject: [Dev-C++] short integer problem > > > Thanks for all the useful replies on this. They helped me > clear up some > other minor mysteries regarding double variables. My text > did not mention > format specifiers hd, le or lg at the appropriate times ( only in the > appendix once I knew what I was looking for ). > > Two related questions if I may: > > double should be equivalent to long float but long float > gives compiler > error. Was the ANSI standard changed? The latest ANSI C standard was ratified in 1999. However a long float type never existed. The built in non-pointer types of ANSI C 1989 (not mentioning signed and unsigned integer types explicitly) are: char, short, int, long, float, double and long double. > long double compiles but I get strange behavior as I did > for short when > using %d instead of %hd. I looked for long double in > Kernighan & Ritchie > but saw only the modifiers h & l. Is there a format > specifier for long > double? Yes. %lf. However long double has extremelly high precision and that means some time cost. Use long double when you want very very high floating point precision. In almost all cases float and double (when you want high precision) are sufficient. > If not, why do I not get an error in compiling as I > did for short > char? C has not a strong type safe system. Also it is very hard to check argument validity in variadic functions. Also there is not a short char type and i do not understand completely what warnings you mean. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |