العودة إلى  مدرسة الكمبيوتر   قسم البرمجة    الصفحة الأولى

#DEFINE ... #UNDEF Preprocessor Directive

Creates and releases compile-time constants.

Syntax

#DEFINE ConstantName eExpression
...

#UNDEF ConstantName

Arguments

ConstantName

Specifies a compile-time constant name. The constant name must be a legitimate Microsoft Visual FoxPro name that begins with a letter or an underscore and consists of up to 254 letters, digits, or underscores. To improve program readability and simplify debugging, capitalize your constant names and use a standard naming convention for them.

Important   Do not use Visual FoxPro keywords for constant names.

To stop text substitution for a constant created with #DEFINE, issue #UNDEF ConstantName.

eExpression

Specifies the value of the compile-time constant. eExpression can be a name or an expression that evaluates to a character, numeric, currency, date, datetime, or logical value.

Important   Do not use system variables for eExpression. System variables are not evaluated until run time.

Remarks

The #DEFINE and #UNDEF preprocessor directives are used to create compile-time constants in programs. By creating constants with #DEFINE instead of using variables, you can reduce memory consumption, increase performance, and simplify programs.

To create a constant with #DEFINE, specify the constant's name with ConstantName and its value with eExpression. When the program is compiled, text substitution is performed and the constant value expression is substituted for the constant name wherever it appears in the program. You can stop the substitution for the constant by issuing #UNDEF.

Substitution occurs only in program lines that follow the #DEFINE statement that creates the constant and that precede the #UNDEF statement for that constant. The constant is available only to the program that creates the constant.

If #DEFINE is placed within an event or method procedure in a form, the #DEFINE compile-time constant is available only within the event or method procedure. To make #DEFINE compile-time constants available to all event and method procedures in a form, choose the Include File menu item from the Form menu and specify a header file containing the #DEFINE compile-time constants.

Note that compile time constants are not recognized when placed within quotation marks.

 

 طباعة المقال العودة إلى  مدرسة الكمبيوتر   قسم البرمجة    الصفحة الأولى
Syria
سورية
Amrit
عمريت
أرواد
طرطوس
صور من طرطوس
صور من سورية
للسيدات فقط
معجم الكمبيوتر
أدب وفكر
المجلة الطبية
المعلومات العامة
لمحة عن طرطوس
الموضة النسائية
مدرسة الكمبيوتر
 © 2002-2012 LBCInformation Corporation. All rights reserved م حنا عطا لحود.