This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA v3] Convert observers to C++


Hi Tom,

In the new file gdb/observable.h, I can't help but notice that
the observer's documentation is less clear than before when
the observer has some arguments. For instance, taking one observer
as an example:

> +/* The status of process record for inferior inferior in gdb has
> +   changed.  The process record is started if started is true, and
> +   the process record is stopped if started is false.
> +
> +   When started is true, method indicates the short name of the
> +   method used for recording.  If the method supports multiple
> +   formats, format indicates which one is being used, otherwise it
> +   is NULL.  When started is false, they are both NULL.  */
> +extern observable<struct inferior *, int, const char *, const char *>
> +    record_changed;

The documentation mentions the arguments by name, except we don't have
the name. For some observers where the arguments are strongly typed
and with obvious names, it's relatively easy to find your way around,
but it's much harder I think in the case above.

Is there something C++ can do, for us? Otherwise, would people consider
the idea of adding the variable name as a comment? Eg:

    extern observable<struct inferior * /* inferior */,
                      int /* started */,
                      const char * /* method */,
                      const char * /* format */>
        record_changed;

In addition to making the documentation clear, I think it's nicer to
have the parameter names here, as it provides a "suggestion" as to
what the name of the parameter should be in the function passed as
the callback, which helps keeping things consistent.

I'll agree that the above suggestion with the comment as a parameter
name is not very appealing - it's the only thing that comes to mind
at the moment.

Thanks!
-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]