bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] directory separator


From: John Darrington
Subject: Re: [PATCH] directory separator
Date: Thu, 7 Jun 2012 07:49:06 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

On Thu, Jun 07, 2012 at 12:29:03AM -0700, Paul Eggert wrote:
     On 06/07/2012 12:19 AM, John Darrington wrote:
     > Surely using a symbol instead of a literal constant makes maintenance 
easier not 
     > harder? 
     
     I don't see why.  For example:
     
       remove ("a/b");
     
     is simpler and easier to maintain than:
     
       #if DIRECTORY_SEPARATOR == '/'
        #define DIRECTORY_SEPARATOR_STRING "/"
       #elif DIRECTORY_SEPARATOR == '\\'
        #define DIRECTORY_SEPARATOR_STRING "\\"
       #else
        #error "Unknown DIRECTORY_SEPARATOR" DIRECTORY_SEPARATOR
       #endif
     
       remove ("a" DIRECTORY_SEPARATOR_STRING "b");

One reason is that one could easily find all the places where constructed paths 
are
used in Gnulib using grep.

Another reason is that it would be trivial to add support for some future 
operating 
system that decides to use a different character (neither / nor \) as the 
directory
separator.

A third reason:  "a/b" looks to me like a mathematical expression, whereas 
"a" DIRECTORY_SEPARATOR_STRING "b" is explicit and unambiguous.


Anyway, if you really have an aversion to this patch I won't force it upon you 
until
I have some hard evidence that it is causing a tangible problem.  

(It would make our job easier however, if these "probably not the cause of the 
problem but who knows" issues were fixed upstream.)


Regards, 


J'


-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]