This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [patch 2/4] Code cleanup: Remove const in prototype
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 14 Nov 2013 20:19:32 +0100
- Subject: 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