Skip to content

Commit

Permalink
Improve noexcept usage. (#997)
Browse files Browse the repository at this point in the history
* Make `File::getName()` not noexcept.

It's likely not `noexcept`. Therefore, it would terminate when it
encounters an issue.

* Make `Selection::get*` not `noexcept`.
  • Loading branch information
1uc authored May 10, 2024
1 parent 259e1ba commit 1206407
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/highfive/H5File.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class File: public Object, public NodeTraits<File>, public AnnotateTraits<File>
///
/// \brief Return the name of the file
///
const std::string& getName() const noexcept;
const std::string& getName() const;


/// \brief Object path of a File is always "/"
Expand Down
8 changes: 4 additions & 4 deletions include/highfive/H5Selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ class Selection: public SliceTraits<Selection> {
/// \brief getSpace
/// \return Dataspace associated with this selection
///
DataSpace getSpace() const noexcept;
DataSpace getSpace() const;

///
/// \brief getMemSpace
/// \return Dataspace associated with the memory representation of this
/// selection
///
DataSpace getMemSpace() const noexcept;
DataSpace getMemSpace() const;

///
/// \brief getDataSet
/// \return parent dataset of this selection
///
DataSet& getDataset() noexcept;
const DataSet& getDataset() const noexcept;
DataSet& getDataset();
const DataSet& getDataset() const;

///
/// \brief return the datatype of the selection
Expand Down
2 changes: 1 addition & 1 deletion include/highfive/bits/H5File_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ inline File::File(const std::string& filename,
_hid = detail::h5f_create(filename.c_str(), createMode, fcpl, fapl);
}

inline const std::string& File::getName() const noexcept {
inline const std::string& File::getName() const {
if (_filename.empty()) {
_filename = details::get_name([this](char* buffer, size_t length) {
return detail::h5f_get_name(getId(), buffer, length);
Expand Down
8 changes: 4 additions & 4 deletions include/highfive/bits/H5Selection_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ inline Selection::Selection(const DataSpace& memspace,
, _file_space(file_space)
, _set(set) {}

inline DataSpace Selection::getSpace() const noexcept {
inline DataSpace Selection::getSpace() const {
return _file_space;
}

inline DataSpace Selection::getMemSpace() const noexcept {
inline DataSpace Selection::getMemSpace() const {
return _mem_space;
}

inline DataSet& Selection::getDataset() noexcept {
inline DataSet& Selection::getDataset() {
return _set;
}

inline const DataSet& Selection::getDataset() const noexcept {
inline const DataSet& Selection::getDataset() const {
return _set;
}

Expand Down

0 comments on commit 1206407

Please sign in to comment.