Freigeben über


Directives and Macros are Case-Insensitive

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

The X++ precompiler directives, the macro names that they define, and the #if directive value tests are all case-insensitive. However, it is considered among the Macros Best Practices to begin macro names with an uppercase letter.

Prerequisites

For this topic, you must understand the information in How to: Test a Macro Value.

Code Sample

The following X++ code sample shows mismatches in casing. The output shows that the precompiler is case-insensitive.

    static void CaseInsensitiveDirectiveMacroJob(Args _args)
    {
        ;
        //-----------  #localmacro  --------
        #LOcalMAcro.YOurLM
            info("From YOurLM localmacro.");
        #ENdMAcro
        #yoURLM // Mismatched casing of the macro name symbol.
    
        //-----------  #define  --------
        #deFine.MyMaCRO("TheVaLUE")
        // Mismatched casings, in macro name, and in parentheses.
        #iF.mYmacro("ThEvaLUE")
            info("The # if test for value is case-insensitive for the value.");
        #eNdif
    
    /************  Actual Infolog output
    Message (09:38:53 am)
    From YOurLM localmacro.
    The # if test for value is case-insensitive for the value.
    ************/
    }

See also

Macros in X++

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.