hwright@tigris.org wrote:
> Author: hwright
> Date: Thu Apr 12 10:09:55 2007
> New Revision: 24558
>
> Log:
> JavaHL: Add implicit type conversion to the C++ Revision class, allowing
> objects of this class to be directly used wherever a svn_opt_revision_t * is
> expected. Also add a couple of helper functions to return the revision number
> and kind of the wrapped revision.
Hi Hyrum,
Let's hold off on these implicit type conversions until we reach a
consensus on them. I don't think they are a good design decision.
As others have written:
"The upshot is that while conversion operators are handy, they
compromise type safety and disarm the compiler of its type-safety
checks. For this reason, library designers either forgo conversion
operators at the cost of inconveniencing users (the lack of a const char
* conversion operator in std::string is a classic example of this), or
they resort to embarrassingly contrived constructs to support this
notion without its dangerous consequences."
http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=297&rl=1
> Modified: trunk/subversion/bindings/javahl/native/CopySources.cpp
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/javahl/native/CopySources.cpp?pathrev=24558&r1=24557&r2=24558
> ==============================================================================
> --- trunk/subversion/bindings/javahl/native/CopySources.cpp (original)
> +++ trunk/subversion/bindings/javahl/native/CopySources.cpp Thu Apr 12 10:09:55 2007
> @@ -129,7 +129,7 @@
> Revision rev(jrev);
> src->revision = (const svn_opt_revision_t *)
> apr_palloc(pool, sizeof(*src->revision));
> - memcpy((void *) src->revision, rev.revision(),
> + memcpy((void *) src->revision, (const svn_opt_revision_t *) rev,
This syntax is definitely not any cleaner. I would much rather see
rev.revision() than (const svn_opt_revision_t *) rev.
Regards,
Blair
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 12 19:23:18 2007