[Geany-Devel] Memory leaks in Geany
dimitar.zhekov at xxxxx
Wed Sep 25 17:08:27 UTC 2013
On Wed, 25 Sep 2013 09:23:15 +0800
Chow Loong Jin <hyperair at ubuntu.com> wrote:
> On Wed, Sep 25, 2013 at 12:27:14AM +0200, Colomban Wendling wrote:
> > [...]
> > > Other suggestions:
> > > - enable -Wall -Wextra -Werror in compiler
This combinarion may lead to a lot of unnecesary "fixes" purely to
> > Yes, kinda advertized in HACKING -- but -Werror is harder to use because
> > you need to check your flags VERY carefully not to produce any false
> > positive. E.g. -Wwrite-strings have a few false positive due to
> > imperfect API. But yeah, it's nice to stop on possible errors. FTR, we
> It's not acceptable to modify const strings. Ever.
Nobody really modifies them, that causes SIGSEGV.
> An API that takes a const char* can also take non-const char*'s. So if the
> function doesn't need to modify the string, it should just take a const char *
The non-Geany API-s are not under out control.
A function may modify a string (or any other *) with one set of
documented arguments, and never modify it with another set of
arguments. That's rare, but the separation between const and non-const
is not absolute. And of course, there are memchr(), strstr() etc.
which take a "maybe-const" and return it as non-const.
More information about the Devel