home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18757 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.9 KB  |  47 lines

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