[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Another type issue.

From: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2001-02-26 23:01:51 CET

We should use svn_string_t whenever:

        * We are passing a mutable string, or
        * We need to represent binary data (including 0 bytes)

We should use char * whenever the above aren't true, i.e. when we're
passing an immutable string which can only contain text data.

That's my position.  Some rationale:
We could use svn_string_t everywhere.  It would be kind of a pain in
the butt (because we'd have to convert every time we wanted to use a
system call or apr string-handling routine, and because we'd have to
worry about memory allocation even when we were just passing a
literal), but it would work.  But we've rejected that approach.
Frankly, I think it's a tiny bit unclean to pass an svn_string_t * for
an immutable string when we are representing binary data.  But blame C
for using a half-assed string type for that gaffe.  A "const"
qualifier will make it clear that the called function isn't allowed to
modify the string.
Received on Sat Oct 21 14:36:23 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.