This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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: [patch 2/4] Code cleanup: Remove const in prototype


On Sun, 2013-11-10 at 21:21 +0100, Jan Kratochvil wrote:
> cv-qualifier in declaration has no effect on callers but the parameter needs
> to be modified in function implementation in [patch 3/4].  To keep the code
> consistent I have removed it everywhere.
>
> Code cleanup: Remove const in prototype
> 
> libdwfl/
> 2013-11-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Code cleanup: Remove const in prototype
> 	* dwfl_frame_regs.c (dwfl_thread_state_registers): Remove const from
> 	firstreg.
> 	* libdwfl.h (dwfl_thread_state_registers): Likewise.
> 	* linux-pid-attach.c (pid_thread_state_registers_cb): Likewise.
> 
> libebl/
> 2013-11-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Code cleanup: Remove const in prototype
> 	* libebl.h (ebl_tid_registers_t): Remove const from firstreg.

I think removing the const is harmless like you said. A const int is
passed by value, so is only a hint to the caller. But I am surprised you
need this. We does the parameter need to be modified? Can't you just
pass firstreg + 1 or first assign to a local var before passing the
(const) int around?

Cheers,

Mark


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