Channels ▼

Bob Stout

Dr. Dobb's Bloggers

Whither SNIPPETS?

September 25, 2009

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:

  1.  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.
  2. 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.
  3. 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.
  4. The entire collection will be reposted to the SNIPPETS.ORG server as soon as possible.
  5. I'm currently going through the Snippets already posted and will send updates to Dr. Dobb's for reposting.

The first issue to be addressed is the code Dr. Dobb's recently republished for calculating wind chill (C Snippet #4) .  Go here to see the updates which includes the following:

  • 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.
Thanks to the readers whose corrections and suggestions prompted these changes.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video