J3/06-343 Date: October 31, 2006 To: J3 From: Aleksandar Donev Subject: Notes on Clause 3 References: 06-210r2, 06-007r1 At meeting 177 only the "Simple editorial corrections" sections of 06-210r2 were processed. Here I resubmit: 1) Requests to clarify or change wording 2) Technical issues _________________________________ Changes of wording _________________________________ [34:26-27] C313 needs to be rewritten so that it does not have three negatives: "If the first token is MACRO the second token shall be not be a keyword or name." Question: Can the first be DEFINE or EXPAND? If yes, then why are these separate items in the BNF for R322? The way things are it is ambiguous whether a statement DEFINE MACRO ... is a or a . As a specific example, can a macro define a macro with a variable number of arguments, where the number of arguments is an argument of the top-level macro? [Annex C] There is a clear provision for macros defining macros. Here is an attempt at an example of using such a macro---to be included in a Note or Annex C: --------- ! Macro that defines a macro which assigns a value to an array element DEFINE MACRO :: assign_shortcut(rank) DEFINE MACRO assign_%%rank(array,indices,value) MACRO INTEGER :: i array(indices(1)&& MACRO DO i=2,rank ,indices(i)&& MACRO END DO )=value END MACRO assign_%%rank END MACRO assign_shortcut ! Create assignment macros for all ranks MACRO DO i=1,15 EXPAND assign_shortcut(i) MACRO END DO ! Now use the rank-3 assignment macro: REAL :: A(10,10,10) INTEGER :: indices(3)=[1,5,6] EXPAND assign_3(A,indices,5.0) ! Expands to: ! A(indices(1),indices(2),indices(3))=5.0 --------- [36:30] I find "statement-dependent" in item (3) too vague---maybe say "Macro statement processing". The expansion of macros is in a sense iterative, expanding MACRO and EXPAND statements until there are none left to expand. This was not really clear to me from reading the description. [38:5-6] I believe that we should be specific that token replacement and concatenation are the ONLY forms of expansion that occur. _________________________________ Technical questions _________________________________