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] New qRelocInsn RSP packet, docs and NEWS.


>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:

Pedro> +char *unpack_varlen_hex (char *buff, ULONGEST *result);

Tom> It seems like this declaration could go in tracepoint.h.

Pedro> This function does live in remote.c, but it's defined further
Pedro> down, close to its siblings.  tracepoint.c is also reusing it
Pedro> since not to long ago (since tracing moved to target_ops).
Pedro> remote.h would make a bit more sense though one could argue it
Pedro> could also live in a shared utils.c-kind of file nowadays.

Oops, sorry about the mistake.  I misread which file the definition is in.

My concern is that duplicate declarations lead to bugs, because they can
insulate a module from changes to an API it uses.  Ideally, I think that
all non-static objects ought to have a single declaration in a single
header file, which is included by all users.

Exactly where something lives is secondary to me.  I do think it is
generally better for generic functions to be somewhere like utils.c.
The only real failure mode to a bad placement is a bit of code
duplication, though, and that isn't as serious a problem, at least not
for "leaf" things like this.

thanks,
Tom


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