To be clear, I'm not suggesting that there *should* be a one-to-one
correspondence between messages and options. Options should, I think,
be more stable than diagnostic messages. Changing options can break
build scripts (which is why they're not localized). Diagnostic messages
are primarily intended for immediate human consumption.
I don't have specific examples, but I can imagine a command-line option
that affects multiple different diagnostic messages, which might be
split for greater precision.
>> For another, MS-style error codes are language-independent. If a
>> user asks about an error message in French, it's difficult to search
>> for it; an unambiguous error code makes that easier.
>
> The flags are language independent - they are not translated. While
> it's reasonable to say it's a bit unfair to use have identifiers that
> are terms in English, I don't think it helps to have identifiers that
> have no meaning in /any/ language.
The point is for the error codes to be searchable, not meaningful.
>> I wouldn't mind if gcc added similar codes (using a distinct form that
>> can't be confused with Microsoft's error messages), perhaps with an
>> option to enable or disable them. Ideally they'd be coordinated with
>> clang and any other compilers that aim for gcc compatibility.
>
> gcc (I don't know about clang) has various options for their error
> messages, including colour, position highlighting, and now JSON for
> easier software parsing. It would not be unreasonable to have some kind
> of numeric identifier in that kind of output (there may be one already).
On the other hand, if the option is off by default, then most users
won't enable them, which would limit their usefulness. Visual Studio,
if I'm not mistaken, always shows the unique codes. (Of course it also
shows a human-readable message in an appropriate language.)
> I think coordination with clang here is a bit optimistic - they have
> quite a few differences in their warnings and error messages. It might
> be possible to get agreement on some of the messages, but there'd be
> plenty of differences.
>
> I understand that people have different opinions on this - I can only
> give mine, based on personal preference and personal experience of using
> compilers (not MSVC) with numeric codes for warning flags and messages.