[
https://issues.apache.org/jira/browse/HDFS-7207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14164638#comment-14164638
]
Zhanwei Wang commented on HDFS-7207:
------------------------------------
Not exposing exceptions in public APIs in libhdfs3 is good to improve the ABI
compatibility and make c\+\+ interface is more useful. [~wheat9]'s suggestion
is pretty good.
I do not think it is necessary to add additional C\+\+ interface for libhdfs
and libwebhdfs.
1) Both libhdfs and libwebhdfs are implemented in C, and all C and C\+\+
application can use C interface.
2) libhdfs3 also implements the C interface, Any existing application which is
using libhdfs and libwebhdfs can easily switch to libhdfs3.
3) New application usually prefer C interface instead of C\+\+ because C
interface is more stable.
4) If new application decides to use libhdfs3, which means it has no
requirement of access S3 and other features not supported in libhdfs or
libwebhdfs. Therefore it will not switch back to libhdfs or libwebhdfs.
5) If new application wants to use the feature in libhdfs3 but not implemented
yet (like encryption), it can use libhdfs or libwebhdfs with C interface and
switch to libhdfs3 later.
So, it is more important to implement compatible C interface in libhdfs3
instead of adding additional C\+\+ interface to libhdfs and libwebhdfs.
I think [~wheat9]'s purpose of creating this jira is to remove the exception
from libhdfs3's C\+\+ API to make libhdfs3's C\+\+ API more useful.
> libhdfs3 should not expose exceptions in public C++ API
> -------------------------------------------------------
>
> Key: HDFS-7207
> URL: https://issues.apache.org/jira/browse/HDFS-7207
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Haohui Mai
> Assignee: Colin Patrick McCabe
> Priority: Blocker
> Attachments: HDFS-7207.001.patch
>
>
> There are three major disadvantages of exposing exceptions in the public API:
> * Exposing exceptions in public APIs forces the downstream users to be
> compiled with {{-fexceptions}}, which might be infeasible in many use cases.
> * It forces other bindings to properly handle all C++ exceptions, which might
> be infeasible especially when the binding is generated by tools like SWIG.
> * It forces the downstream users to properly handle all C++ exceptions, which
> can be cumbersome as in certain cases it will lead to undefined behavior
> (e.g., throwing an exception in a destructor is undefined.)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)