23.03.2017 Views

SEI CERT C++ Coding Standard

sei-cert-cpp-coding-standard-2016-v01

sei-cert-cpp-coding-standard-2016-v01

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Declarations and Initialization (DCL) - DCL53-CPP. Do not write syntactically ambiguous declarations<br />

2.4.5 Noncompliant Code Example<br />

This noncompliant code example demonstrates a vexing parse. The declaration Gadget<br />

g(Widget(i)); is not parsed as declaring a Gadget object with a single argument. It is<br />

instead parsed as a function declaration with a redundant set of parentheses around a parameter.<br />

#include <br />

struct Widget {<br />

explicit Widget(int i) { std::cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!