Re: [RFC-v5] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)

Tom Tromey
2012-12-13T20:05:57Z

Pierre> + char *section_name; /* Recorded section name.

Tom> It seems like this could be const.

Pierre> Sorry,
Pierre> but you will need to teach me some more C language
Pierre> so that I understand what that would change...
Pierre> In pascal the const only exists for function/procedure parameters
Pierre> not for fields of structures...
Pierre> Does it simply mean that any attempt to use it
Pierre> as a (char *) type will result in an error?
Pierre> But them, how can you set the value of such a field?

In C the const modifies the type. So "const char *section_name" means
"section name is a pointer to const characters" -- that is, the
characters cannot be modified via the "section_name" pointer.

In this case const is probably borderline useful.
In other parts of gdb, where used[*], it serves both a documentation
purpose and as a barrier against coding mistakes.

[*] It isn't extremely widely used since gdb predates the existence of
const.

Pierre> Sorry about my ignorance...
Pierre> Remember that I am a pascal fan lost in C land just because
Pierre> I maintain GDB pascal language support...

No worries.

Tom