C# Language Specification



Download 0,75 Mb.
bet60/524
Sana06.01.2022
Hajmi0,75 Mb.
#324842
1   ...   56   57   58   59   60   61   62   63   ...   524
Bog'liq
CSharp Language Specification

Declaration directives


The declaration directives are used to define or undefine conditional compilation symbols.

pp-declaration:
whitespaceopt # whitespaceopt define whitespace conditional-symbol pp-new-line
whitespaceopt # whitespaceopt undef whitespace conditional-symbol pp-new-line


pp-new-line:
whitespaceopt single-line-commentopt new-line

The processing of a #define directive causes the given conditional compilation symbol to become defined, starting with the source line that follows the directive. Likewise, the processing of an #undef directive causes the given conditional compilation symbol to become undefined, starting with the source line that follows the directive.

Any #define and #undef directives in a source file must occur before the first token (§2.4) in the source file; otherwise a compile-time error occurs. In intuitive terms, #define and #undef directives must precede any “real code” in the source file.

The example:

#define Enterprise

#if Professional || Enterprise


#define Advanced
#endif

namespace Megacorp.Data


{
#if Advanced
class PivotTable {...}
#endif
}

is valid because the #define directives precede the first token (the namespace keyword) in the source file.

The following example results in a compile-time error because a #define follows real code:

#define A


namespace N
{
#define B
#if B
class Class1 {}
#endif
}

A #define may define a conditional compilation symbol that is already defined, without there being any intervening #undef for that symbol. The example below defines a conditional compilation symbol A and then defines it again.

#define A
#define A

A #undef may “undefine” a conditional compilation symbol that is not defined. The example below defines a conditional compilation symbol A and then undefines it twice; although the second #undef has no effect, it is still valid.

#define A
#undef A
#undef A


      1. Download 0,75 Mb.

        Do'stlaringiz bilan baham:
1   ...   56   57   58   59   60   61   62   63   ...   524




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish