Question: I went through several discussion, tutorials etc. and I've a feeling like there is no way to inform the user using prototype, that his function might throw an exception.

For instance:

```
/* AudioStream.h */
class AudioStream
{
   int open(struct stream_settings &settings);
}

```

```
/* AudioStream.cpp */
int AudioStream::open(struct stream_settings &settings)
{
    int err;
    err = snd_pcm_open(...);
    if (err < 0)
    {
        /* Throw some exception here */
    }
}

```

If the final product ends up in a library with a header. How does one figures out, that the open function throws an exception and it's necessary to put it into a try/catch block?

Thank you for all the great answers.

Answer: 
Unlike some languages which indicate in the function signature that it "throws", C++ has no such mechanism. This is something you must establish in the documentation or comments near the function definition.
You can use `noexcept(false)` to explicitly specify that a function can throw. This does not add any information for the compiler, since *can throw* is the implicit default for every function without an `noexcept` specification.

So the recommended way would probably be to add a `noexcept` specifier to each function that cannot throw.

See also <https://en.cppreference.com/w/cpp/language/noexcept_spec> and [Does adding `noexcept(false)` benefit the code in any way?](https://stackoverflow.com/questions/16244313/does-adding-noexceptfalse-benefit-the-code-in-any-way)