public inbox for [email protected]
help / color / mirror / Atom feedFrom: Junwang Zhao <[email protected]>
To: Chao Li <[email protected]>
Cc: zhanghu <[email protected]>
Cc: [email protected]
Subject: Re: guc: make dereference style consistent in check_backtrace_functions
Date: Thu, 26 Feb 2026 19:04:24 +0800
Message-ID: <CAEG8a3KqfVfHbHN5ZqNBmEhf9AkiccvP9GRtQRTYWad2yzWvOA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAB5m2QssN6UO+ckr6ZCcV0A71mKUB6WdiTw1nHo43v4DTW1Dfg@mail.gmail.com>
<[email protected]>
On Thu, Feb 26, 2026 at 5:21 PM Chao Li <[email protected]> wrote:
>
>
>
> > On Feb 26, 2026, at 15:03, zhanghu <[email protected]> wrote:
> >
> > Hi,
> >
> > In check_backtrace_functions(), most accesses to the input string follow the pattern (*newval)[i]. However, the empty-string check is currently written as:
> >
> > if (*newval[0] == '\0')
> >
> > While functionally correct due to how the compiler handles the address-of-address context here, this form is semantically misleading. It relies on implicit operator precedence rather than explicit intent.
> >
> > The attached patch rewrites it as:
> >
> > if ((*newval)[0] == '\0')
> >
> > This change ensures semantic clarity and maintains a consistent dereferencing style throughout the function. No functional changes are introduced.
> >
> > Regards,
> > Zhang Hu
> > <v1-0001-guc-make-dereference-style-consistent-in-check_ba.patch>
>
> This is an interesting find.
>
> [] has higher precedence than *, so:
>
> - (*newval)[i] means to get the first string, then get the char at position i
> - *newval[i] means to get the array element at position i, then get the first char
>
> When i is 0, (*newval)[0] and *newval[0] happen to yield the same result, so this isn't a functional bug.
>
> However, in the GUC context, newval is a point to a string rather than a two-dimension char array, *newval[i] is meaningless, so +1 for fixing this to improve readability.
+1
The double pointer indicates an output parameter, the commit
message should be adjusted though.
>
> Best regards,
> --
> Chao Li (Evan)
> HighGo Software Co., Ltd.
> https://www.highgo.com/
>
>
>
>
>
>
--
Regards
Junwang Zhao
view thread (3+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: guc: make dereference style consistent in check_backtrace_functions
In-Reply-To: <CAEG8a3KqfVfHbHN5ZqNBmEhf9AkiccvP9GRtQRTYWad2yzWvOA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox