Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Correction for late binding to local listener on api server #1227

Merged
merged 1 commit into from
Jun 6, 2018

Conversation

AndreaLanfranchi
Copy link
Collaborator

Amends #1223

@AndreaLanfranchi AndreaLanfranchi changed the base branch from master to release/0.15 June 6, 2018 07:43
@chfast chfast merged commit 076b469 into release/0.15 Jun 6, 2018
@chfast chfast deleted the api-server branch June 6, 2018 08:09
m_acceptor.bind(endpoint);
m_acceptor.listen(64);
}
catch (const std::exception& _e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndreaLanfranchi: _e is unreferenced here; MSVC complains about it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a very strange complaint as it's quite common standard to catch exception by reference. Do you mean it wants it by value ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just using one of MSVC's macros like UNREFERENCED_PARAMETER(_e); should do the trick.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the directive be accepted by other compilers ? Or should I enclose it in a conditional block if _WIN32 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This macro is MSVC specific, so we probably need to wrap it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just omit the name _e.

Copy link
Contributor

@jean-m-cyr jean-m-cyr Jun 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chfast approach is commonly used. ie. catch (const std::exception&)

Or, you can just add a "(void)_ec;" statement in the block. It doesn't generate any machine code and will satisfy the compiler. It's how you did it in K&R C.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants