home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- 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
- From: jutta@opal.cs.tu-berlin.de (Jutta Degener)
- Subject: Re: sccs eats good code -
- Message-ID: <1992Dec22.035408.22372@cs.tu-berlin.de>
- Sender: news@cs.tu-berlin.de
- Organization: Techn. University of Berlin, Germany
- References: <1992Dec21.4396.29992@dosgate> <1992Dec22.005828.20926@jpl-devvax.jpl.nasa.gov>
- Date: Tue, 22 Dec 1992 03:54:08 GMT
- Lines: 38
-
- > Distribution: comp
- Whoever added this should get their software fixed.
-
- kaleb@jpl-devvax.jpl.nasa.gov (Kaleb Keithley) writes:
- >In article <1992Dec21.4396.29992@dosgate> peter.curran@canrem.com writes:
- >> A simple solution is to replace the original string with something
- >> like "%w%\H%\M%\S". Ugly, but it works. [..]
- >
- > 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.
-
- And rightly so, not only because you apparently think that support
- people can neither think nor read (comments).
-
- In ANSI C, backslashes in front of anything except x[0-9A-Fa-f]+|
- [0-7]{1,3}|[abfnrtv'"\?] yield undefined behaviour. (Vendors may add
- their own escape sequences to the set, or may have already done so,
- without becoming nonstandard.)
-
- If you're restricted to ANSI C, stick to string literal concatenation.
- I can't think of an elegant solution that is both portable between
- ANSI and K&R C and between different character encodings.
-
- Another portable alternative to the suggested
-
- static char fmt[] = { '%','w','%','H','%','M','%','S','\0' };
-
- (braces courtesy of International Brace Fund for the Needy ;-) would be
-
- if (strftime(time_str, 64, "%w%H\
- %M%S", time_struct) != 7)
-
- which is an even uglier kludge, but easier to automate and a more
- local change.
-
- Jutta Degener (jutta@cs.tu-berlin.de)
-