home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!ufo!kaleb
- From: kaleb@jpl-devvax.jpl.nasa.gov (Kaleb Keithley)
- Subject: Re: sccs eats good code -
- Message-ID: <1992Dec22.005828.20926@jpl-devvax.jpl.nasa.gov>
- Organization: Jet Propulsion Laboratory (NASA)
- References: <1992Dec21.4396.29992@dosgate>
- Distribution: comp
- Date: Tue, 22 Dec 1992 00:58:28 GMT
- Lines: 35
-
- In article <1992Dec21.4396.29992@dosgate> "peter curran" <peter.curran@canrem.com> writes:
- >In article <1992Dec18.215413.65833@evolving.com> jww@evolving.com
- >(John W. Woolley) writes:
- >
- >>We had a chunk of source so:
- >> if (strftime(time_str, 64, "%w%H%M%S", time_struct) != 7)
- >>
- >>Nice normal ANSI C. But SCCS had spotted the string %H% in the
- >>above bit of code, and had done its replacement thing so:
- >>
- >> if (strftime(time_str, 64, "%w12/14/92M%S", time_struct) != 7)
- >>
- >A simple solution is to replace the original string with something
- >like "%w%\H%\M%\S". Ugly, but it works. Unfortunately, it is an
- >"active" solution - if you don't notice the problem when you write
-
- I think this bites everyone who uses SCCS. I agree that Peter's solution is
- ugly, because the person who' maintaining the code comes along, doesn't
- immediately recognize why the backslashes are there, and strips them out
- without thinking. Comments might help, but I think they might be hard
- to keep attached with the statement; especially with some of the more
- convoluted expressions that some people like to write. As to why a
- maintenance programmer would change working code... :-)
-
- I like the following, if only because it stands out, and it might be micro-
- scopically easier to keep an explanatory comment right there along side it.
-
- static char frmt[] = '%', 'w', '%', 'H', '%', 'M', '%', 'S', '\0';
- [...]
- if (strftime(time_str, 64, frmt, time_struct) ...
-
- --
-
- Kaleb Keithley kaleb@jpl-devvax.jpl.nasa.gov
-
-