From: Alan W. I. <ir...@be...> - 2006-10-10 16:13:52
|
On 2006-10-10 09:33+0200 Arjen Markus wrote: > Werner Smekal wrote: > >> Hi, >> >>> The C compiler complained about a number of errors in our source >>> files that >>> other compilers did not notice or gave warnings about. I did not have >>> time >>> yet to look into them, but I think it is worth checking these. >> >> >> Visual C++ 2005 gives also tons of warnings, especially about the use >> of sprintf (instead of snprintf), deprecated features (according to >> the C99 standard) and unused variables. Question is, if we should >> change the code accordingly - I would highly suggest it and would also >> do some work on it - or are there some opinions against such changes? > > Well, warnings I have seen from Visual C/C++ 6.0 (the ancient one) are > mostly > about longs being implicitly converted to ints and the like. Adding > explicit casts > may silence the compiler, but the code is not going to work better and > certainly > is not going to be more readable - in my opinion. I think we will need > to be > careful here. I vote yes to these issues: > - remove unused variables (makes the code less confusing) > - check the use of sprintf() (makes the code safer) > - functions that do not return a value but should (makes the code safer too) > > I do not know enough about C99 to comment on deprecated features, but > I would not like to see explicit casts all over the place. Werner, I think Arjen's suggestions are good ones about limiting the kind of changes you do. Also, to make sure you are not introducing any new issues, I suggest you start conservatively with a few sample changes, and let me test them on Linux/gcc before you apply those same kind of changes to all source files. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |