Vincent Lefevre <vincent-opgr@vinc17.org> wrote, on 05 Aug 2009:
>
> On 2009-08-05 15:59:11 +0100, Geoff Clare wrote:
> > The default behaviour when an option that has option-arguments is
> > repeated is stated in Syntax Guideline 11:
> >
> > If an option that has option-arguments is repeated, the option and
> > option-argument combinations should [shall for standard utilities]
> > be interpreted in the order specified on the command line.
> >
> > In cases where one overrides the other, it would need to be stated
> > explicitly in the utility description.
>
> But this is just a default behavior. Because of the rule concerning
> -U vs -D, the status of this guideline here is not clear.
On the contrary, it is perfectly clear. That part of guideline 11
is about repeating the same option; it has nothing to do with
interactions between different options. Therefore statements
about interactions between different options have no bearing on
whether guideline 11 applies.
> Even
> without that rule. For instance, if you assume that there is no
> override, then with -DFOO=1 -DFOO=2, should this be like
>
> #define FOO 1
> #define FOO 2
>
> or
>
> #define FOO 2
> #define FOO 1
>
> (as the #define are seen as being preprended to the source)?
>
> Even though both forms will yield undefined behavior, the
> specification comes first. And if you assume that the spec is not
> clear enough to determine the order, one can also assume that it is
> not clear enough to determine whether one can consider that -DFOO=2
> overrides -DFOO=1, and this is left to the implementation.
I'll grant that there is enough wriggle room to allow the -D
options to be implemented by "prepending" #define directives; thus
the diagnostic could indicate that the -DFOO=1 is where the error
occurs rather than the -DFOO=2. However, I can see no reasonable
interpretation that allows one to override the other.
--
Geoff Clare <g.clare@opengroup.org>
The Open Group, Thames Tower, Station Road, Reading, RG1 1LX, England
|