Number | 331
|
Category | errata
|
Synopsis | 19.3.1: when is a `define argument not an argument?
|
State | lrmdraft
|
Class | errata-simple
|
Arrival-Date | Apr 14 2003
|
Originator | Shalom.Bresticker@motorola.com
|
Release | 2001b: 19.3.1
|
Environment |
|
Description |
`defines may have arguments. If I have `define cucu (UKUK) ..., then is UKUK an argument of cucu, or is "(UKUK)" the beginning of the definition of cucu? Steve Sharp says "You don't allow a space between the macro name and the argument list in the definition." If there is a space, then it is part of the definition. The LRM must clarify that. Is a space allowed in the USE of the text macro between the name of the `define and its arguments? |
Fix |
(The following is based on CPP documentation.) In 19.3.1, after the text "When formal arguments are used to define a text macro, the scope of the formal argument shall extend up to the end of the macro text. A formal argument can be used in the macro text in the same manner as an identifier." ADD the following new text: "If formal arguments are used, the list of formal argument names shall be enclosed in parentheses following the name of the macro. The formal argument names shall be simple_identifiers, separated by commas and optionally whitespace. The left parenthesis shall follow the macro name immediately, with no space in between." After the text, "For a macro without arguments, the text shall be substituted "as is" for every occurrence of `text_macro_name. However, a text macro with one or more arguments shall be expanded by substituting each formal argument with the expression used as the actual argument in the macro usage." ADD the following new text: "To use a macro defined with arguments, the name of the macro shall be followed by a list of actual arguments in parentheses, separated by commas. White space shall be allowed between the macro name and the left parenthesis. The number of actual arguments shall match the number of formal arguments. " |
Audit-Trail |
From: Steven Sharp <sharp@cadence.com> To: etf-bugs@boyd.com, Shalom.Bresticker@motorola.com Cc: Subject: Re: errata/331: 19.3.1: when is a `define argument not an argument? Date: Mon, 14 Apr 2003 20:44:51 -0400 (EDT) NC-Verilog does not allow a space between the macro name and the argument list in the definition. This is necessary to distinguish the argument list from a macro expansion that starts with a paren. NC-Verilog does allow a space between the macro name and the argument list in the use. It knows that there will be a parenthesized argument list because of the macro definition, so there is no chance for confusion. For reference, ANSI C does not allow a space between the macro name and the argument list in the use, though many implementations accept it. Steven Sharp sharp@cadence.com Fix replaced by Shalom.Bresticker@freescale.com on Thu Nov 25 12:37:06 2004 (The following is based on CPP documentation.) In 19.3.1, after the text "When formal arguments are used to define a text macro, the scope of the formal argument shall extend up to the end of the macro text. A formal argument can be used in the macro text in the same manner as an identifier." ADD the following new text: "If formal arguments are used, the list of formal argument names shall be enclosed in parentheses following the name of the macro. The formal argument names shall be simple_identifiers, separated by commas and optionally whitespace. The left parenthesis shall follow the macro name immediately, with no space in between." After the text, "For a macro without arguments, the text shall be substituted "as is" for every occurrence of `text_macro_name. However, a text macro with one or more arguments shall be expanded by substituting each formal argument with the expression used as the actual argument in the macro usage." ADD the following new text: "To use a macro defined with arguments, the name of the macro shall be followed by a list of actual arguments in parentheses, separated by commas. White space shall be allowed between the macro name and the left parenthesis. The number of actual arguments shall match the number of formal arguments. " |
Unformatted |
|
Hosted by Boyd Technology