Re: Opinion) Overuse of symbolic constants
From: Keith Thompson (kst-u_at_mib.org)
Date: 04/23/04
- Next message: Darrell Grainger: "Re: Weird file writing problem"
- Previous message: Booted Cat: "Named argument view for IDE and more"
- In reply to: Dan Pop: "Re: Opinion) Overuse of symbolic constants"
- Next in thread: Dan Pop: "Re: Opinion) Overuse of symbolic constants"
- Reply: Dan Pop: "Re: Opinion) Overuse of symbolic constants"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 23 Apr 2004 20:39:37 GMT
Dan.Pop@cern.ch (Dan Pop) writes:
> In <4088dfdb.2080231948@news.individual.net>
> rlb@hoekstra-uitgeverij.nl (Richard Bos) writes:
> >mwojcik@newsguy.com (Michael Wojcik) wrote:
> >> In article <c667e8$qok$3@sunnews.cern.ch>, Dan.Pop@cern.ch (Dan
> >> Pop) writes:
> >> > In <Pine.GSO.4.58.0404211032530.12417@drj.pf>
> >> > darrell@NOMORESPAMcs.utoronto.ca.com (Darrell Grainger) writes:
> >> > >However, the SLASH might have a place. I have seen code like:
> >> > >
> >> > >#ifdef WINDOWS
> >> > >#define SEPERATOR '\\'
> >> > >#else
> >> > >#define SEPERATOR '/'
> >> > >#endif
> >> >
> >> > It was probably written by someone ignoring both English and Windows.
> >> >
> >> > In most contexts, Windows accepts the forward slash as path separator.
> >>
> >> Which means that in Windows, you can generally use the forward slash
> >> when generating paths, so there's no need for the macro;
> >
> >You both forget something. Windows _functions_ may be able to understand
> >forward slashes; but Windows _users_ are, in most cases, incapable of
> >comprehending that the backslash is not a god[1]-given holy marking.
> >Ditto, but less so, under Unix. Thus, for human-readable output, you
> >must use the system-sanctified species of slash.
>
> In portable code, the file names are specified by the user. If the user
> gets confused by his own input, there is very little the programmer can
> do...
If the file names are specified by the user, the issue doesn't arise;
re-displaying whatever the user provided is entirely reasonable.
(Mapping the user's input to a more canonical form may or may not be
reasonable; it depends on the circumstances.)
Obviously we're talking about non-portable code with file names
provided or constructed by the program. In that context, it makes
sense to use something that's not going to confuse the user; under
Windows, that means using '\\' rather than '/' as the path separator.
It may not matter if the program never shows any file names to the
user, but a future version of the program may do so even if the
current one doesn't -- or a future version may try to pass a file name
to the command interpreter. (Or there might be some other obscure
circumstances in Windows where '/' and '\\' are not equivalent as path
separators; I'm not assuming there are, but I wouldn't bet against
it.)
-- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> Schroedinger does Shakespeare: "To be *and* not to be"
- Next message: Darrell Grainger: "Re: Weird file writing problem"
- Previous message: Booted Cat: "Named argument view for IDE and more"
- In reply to: Dan Pop: "Re: Opinion) Overuse of symbolic constants"
- Next in thread: Dan Pop: "Re: Opinion) Overuse of symbolic constants"
- Reply: Dan Pop: "Re: Opinion) Overuse of symbolic constants"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|