Function Parameter Names

Function Parameter Names - C has a feature that allows you...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Function Parameter Names Suppose that you have a C++ function, and for some reason you don't actually use all the function parameters: int sum(int a, int b, int c) { return a + b; // c not used } Many compilers will give a warning in this case to the effect "warning: parameter c not used". This is perfectly legal code but the warning can be tedious to deal with.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: C++ has a feature that allows you to simply omit the parameter name: int sum(int a, int b, int) { return a + b; } and avoid the warning. This feature is especially handy when stubbing out code. A similar feature exists in catch handlers used in exception handling....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online