AcademySoftwareFoundation/openexr

weak namespace and include guards

Open

#636 opened on Jan 9, 2020

 (4 comments) (0 reactions) (0 assignees)C (695 forks)auto 404
good first issuehelp wanted

Repository metrics

Stars
 (1,812 stars)
PR merge metrics
 (PR metrics pending)

Description

Currently the OpenEXR Half Float implementation uses less expressive include guard _HALF_H_; makeing a slight modification ie: OPENEXR_HALF_H would allow better integration with other distantly related software packages such as H5CPP a general persistence library for modern C++.

#ifndef _HALF_H_
#define _HALF_H_
...
#endif

And a possible more descriptive, safer alternative:

#ifndef OPENEXR_HALF_H
#define OPENEXR_HALF_H
...
#endif

The suggested change would allow automatic detection of the Float16 header inclusion, providing a better experience to some of your users.

In addition the the include guards, the class half { ... } appears without namespace enclosure; would it be possible to place the class (or the better, all of them) within a namespace? example:

namespace oexr {
....
}

Background: In this HDF5 mailing list post Dr Werner Benger suggested to add OpenEXR/Float16 support to HDF5 C++ or H5CPP. Currently this support has been added with explicit configuration option -DWITH_OPENEXR_HALF

best wishes: steven

Contributor guide