Re: [PATCH] trace2: log progress time and throughput
- From
Chris Torek <chris.torek@gmail.com>
- Date
- Jun 23, 2021, 03:29 UTC
- Message-ID
- <CAPx1Gve_KqzQHanDDTSJ_2QywzNybq-J3wkG8xBC_DUhwVB5Fg@mail.gmail.com>
- In-Reply-To
- <YNKiv2Ar77xAxixz@nand.local>
On Tue, Jun 22, 2021 at 7:56 PM Taylor Blau <me@ttaylorr.com> wrote:
>... I was going to comment on the fact that "(*p_progress)->total" could > be written simply as "*p_progress->total", but I'm (a) not sure that I > actually prefer the latter to the former, and (b) I find that kind of > style comment generally useless.
Also, it can't. :-) The binding order is wrong; *p_progress->total binds as *(p_progress->total), and `p_progress` has to be followed first, so this just doesn't work.
(Go does precedence and operator syntax a bit better than does C, but even in Go one must still parenthesize certain pointer-following operations.)
> But it may make sense to sidestep the whole thing and have a "struct > progress *progress = *p_progress" (that is assigned after we check > p_progress to make sure it's non-NULL) like in stop_progress_msg, which > would clean up a lot of this.
This is the way to go.
Chris