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

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!Germany.EU.net!news.netmbx.de!mailgzrz.TU-Berlin.DE!cs.tu-berlin.de!jutta
  3. From: jutta@opal.cs.tu-berlin.de (Jutta Degener)
  4. Subject: Re: sccs eats good code -
  5. Message-ID: <1992Dec22.035408.22372@cs.tu-berlin.de>
  6. Sender: news@cs.tu-berlin.de
  7. Organization: Techn. University of Berlin, Germany
  8. References: <1992Dec21.4396.29992@dosgate> <1992Dec22.005828.20926@jpl-devvax.jpl.nasa.gov>
  9. Date: Tue, 22 Dec 1992 03:54:08 GMT
  10. Lines: 38
  11.  
  12. > Distribution: comp
  13. Whoever added this should get their software fixed.
  14.  
  15. kaleb@jpl-devvax.jpl.nasa.gov (Kaleb Keithley) writes:
  16. >In article <1992Dec21.4396.29992@dosgate> peter.curran@canrem.com writes:
  17. >> A simple solution is to replace the original string with something
  18. >> like "%w%\H%\M%\S".  Ugly, but it works. [..]
  19. >
  20. > I think this bites everyone who uses SCCS.  I agree that Peter's solution is
  21. > ugly, because the person who' maintaining the code comes along, doesn't 
  22. > immediately recognize why the backslashes are there, and strips them out 
  23. > without thinking.
  24.  
  25. And rightly so, not only because you apparently think that support
  26. people can neither think nor read (comments).
  27.  
  28. In ANSI C, backslashes in front of anything except x[0-9A-Fa-f]+|
  29. [0-7]{1,3}|[abfnrtv'"\?] yield undefined behaviour.  (Vendors may add
  30. their own escape sequences to the set, or may have already done so,
  31. without becoming nonstandard.)
  32.  
  33. If you're restricted to ANSI C, stick to string literal concatenation.
  34. I can't think of an elegant solution that is both portable between
  35. ANSI and K&R C and between different character encodings.
  36.  
  37. Another portable alternative to the suggested
  38.  
  39.     static char fmt[] = { '%','w','%','H','%','M','%','S','\0' };
  40.  
  41. (braces courtesy of International Brace Fund for the Needy ;-) would be
  42.  
  43.     if (strftime(time_str, 64, "%w%H\
  44. %M%S", time_struct) != 7)
  45.  
  46. which is an even uglier kludge, but easier to automate and a more
  47. local change.
  48.  
  49. Jutta Degener (jutta@cs.tu-berlin.de)
  50.