C++.Coding.Standards.1918.Rules.Guidelines [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

C++.Coding.Standards.1918.Rules.Guidelines [Electronic resources] - نسخه متنی

Herb Sutter, Andrei Alexandrescu

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


Examples


Example: Avoid

const

pass-by-value function parameters in function declarations.
The following two declarations are exactly equivalent:

void Fun( int x );
void Fun(

const int x );

// redeclares the same function: top-level const is ignored

In the second declaration, the

const is redundant. We recommend declaring functions without such top-level

const s, so that readers of your header files won't get confused. However, the top-level

const does make a difference in a function's

definition and can be sensible there to catch unintended changes to the parameter:

void Fun( const int x ) {

// Fun's actual definition

// …
++x;

// error: cannot modify a const value

// …
}


/ 521