Cobol accepts expressions for BY CONTENT parameters with new dialect option.
New Cobol dialect option `-Wcontent-expr` allows expressions in BY CONTENT parameters, superseding ISO restrictions.
The Cobol compiler now supports expressions in BY CONTENT parameters, controlled by the new -Wcontent-expr option. This option, added to the IBM dialect, acts as a superset of IBM syntax, allowing constructs like ADDRESS OF and LENGTH OF expressions. This change addresses RT 3611 by relaxing ISO prohibitions on expressions in BY CONTENT parameters when a prototype is not present.
In Details
The Cobol compiler introduces the -Wcontent-expr option, which enables the acceptance of expressions in BY CONTENT parameters. This is integrated into the IBM dialect as a superset of its existing syntax. The change involves modifications to diagnostics, option handling, parser logic (by_content_ok), and symbol table structures (cbl_ffi_arg_t) to accommodate these expressions, addressing RT 3611 and providing an alternative to strict ISO compliance.
- BY CONTENT
- A parameter passing mechanism in COBOL where the value of the argument is passed to the procedure. Changes to the parameter within the procedure do not affect the original argument.
- expression
- A combination of values, variables, operators, and function calls that evaluates to a single value.
- dialect
- A specific variant or implementation of a programming language that may have extensions or deviations from the standard. GCC supports various dialects for languages like COBOL and Ada.
- ISO
- The International Organization for Standardization, which develops and publishes international standards, including those for programming languages like COBOL.