mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
style.9: relax "return (value)" requirement for C++
consider the following C++ code:
struct S { int a, b; };
S f() { return {1, 2}; }
according to style(9), the return statement should be formatted as:
return ({1, 2});
however, this is not valid C++ code and will not compile.
add an exception to style(9) to cover this case.
Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1623
Closes: https://github.com/freebsd/freebsd-src/pull/1623
This commit is contained in:
parent
1ae6faf164
commit
daf47b9ec9
1 changed files with 3 additions and 2 deletions
|
|
@ -22,7 +22,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd February 18, 2025
|
||||
.Dd March 27, 2025
|
||||
.Dt STYLE 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -766,7 +766,8 @@ to any pointer type.
|
|||
.Pp
|
||||
Values in
|
||||
.Ic return
|
||||
statements should be enclosed in parentheses.
|
||||
statements should be enclosed in parentheses where possible.
|
||||
For example, parentheses cannot be used if the value is a C++ braced-init-list.
|
||||
.Pp
|
||||
Use
|
||||
.Xr err 3
|
||||
|
|
|
|||
Loading…
Reference in a new issue