Since this is my first post, I'd like to thank Dr. Dobb's for inviting me to the party.
Dr. Dobb's has begun publishing some of my old C Snippets -- like the one that sorts an array of strings (C Snippet #3) . While many are still useful, I haven't been particularly diligent about maintaining the public collection. This quickly became apparent when letters started coming in with quibbbles and corrections. Putting this in context, I first published the SNIPPETS collection on FidoNet in the days before the ascendancy of the Internet or even the adoption of the ANSI C standard. Most of the collection was complete by 1997. The collection started out as my personal collection of free, reusable code. In that same spirit, I have kept a personal copy fairly well updated.
Since Dr. Dobb's intends to keep publishing these, I need to address this situation. My current plans are:
- Dr. Dobb's is sending me those Snippets they intends to republish so I can make sure they're up to snuff prior to their republication.
- I'll go through the whole collection as quickly as possible to bring everything up to date with the latest versions of the ISO/IEC standard, and to strip out some legacy code which is no longer relevant.
- The original collection was written back in the days of the great PC compiler wars and included a lot of conditional code to support multiple compilers from Microsoft, Borland, Watcom, Zortech/Symantec, and others. I now write for, and test with, only two compilers - Digital Mars C/C++ (the descendant of Zortech/Symantec, and highly compatible with MSVC++) and gcc/g++. Adaptation to other compilers or for specific architectures and/or memory models is left as an exercise for the reader.
- The entire collection will be reposted to the SNIPPETS.ORG server as soon as possible.
- I'm currently going through the Snippets already posted and will send updates to Dr. Dobb's for reposting.
- Based on reader feedback, I found that the formula has changed, so I changed the function accordingly.
- I added the calculation for heat index and renamed the module to weather.c.
- I included an updated version of metric.h and added flags to the functions which allow temperature and wind speed to be specified in either English or metric units.
- I added a test main() function as I have with other SNIPPETS module to facilitate testing. To use it, simply compile with the TEST macro defined. In this case, the data used is hard coded, taken from published tables of wind chill and heat index.