Copyright (c) 2015, Electric Cloud, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

  - Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

  - Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


(As an historical note, the above license instantiates
the "BSD 2-Clause License" template that was presented
by the Open Source Initiative at

  http://www.opensource.org/licenses/bsd-license.php

on 2012-02-23.)


Utilities, Not Interfaces
-------------------------

This directory provides optional C++ utilities that may
make it easier to use various C interfaces in a C++ context.

But this directory should should never be construed as contributing
to the definition of any interface--not even to its documentation.
Interfaces should be defined without reference to this directory.

In future we may need to modify or replace this directory in order
to support a new interface definitions.  Such future changes may be
source-incompatible, but so long as no interface definition makes
reference to these utilities, binary compatibility will be preserved.


Link-Level Dependence
---------------------

If separately compiled dynamic libraries use different versions of
these utilities in the same process, then you must arrange that
both of those libraries either do not export the associated linker
symbols or do not see the linker symbols of the other library.
Otherwise, you could get use of the wrong symbol definitions.

If this restriction becomes a burden, then we may need to consider
placing everything into anonymous namespaces--which might increase
code size more than one would like--or making the names of linker
symbols incorporate version information.  For example, we could
use namespaces whose names includes checksums of the source code
that defines their content.  We can then employ C++ using
directives to restore convenience.  For example:

    namespace vrpsx {}

    namespace vrpsx_d53b92d4 {
        using namespace vrpsx;
    }

    namespace vrpsx {
        using namespace vrpsx_d53b92d4;
    }

    namespace vrpsx_d53b92d4 {
        extern char const bigString[];
    }

We can then write vrpsx::bigString, but the linker
will see vrpsx_d53b92d4::bigString.

The code number can be a checksum of the header, its includes,
and any associated implementation file.

Significantly, each header can use a different distinguishing code,
so that we do not have to recompile users of one header just because
some sibling header changed.  Users can just refer to "vrpsx", and
let the compiler sort out which code to use.

But as yet we do not need this level of complexity.
