On Wed, May 24, 2023 at 07:39:20AM +0200, Laszlo Ersek wrote: > On 5/24/23 04:12, Eric Blake wrote: > > We are inconsistent on whether a cast operator should be separated > > from its argument by a space. As a unary prefix operator, casts bind > > with relatively tight precedence, where only postfix operations > > (including function calls) come higher. We generally don't use a > > space after other prefix operators (*, &, ~, and unary - tend to not > > be followed by space; we are less consistent on !, but that would be a > > separate patch). > > > > Going through the changes individually, it seems like we could eliminate > a handful of the casts altogether; for examle (char *)"string literal" > ones. (The C standard effectively says that a (non-wide) string literal > has type "static char[n]", not "static const char[n]".) But that would > be a different patch, plus I can imagine we have those casts in the > first place because gcc complained or whatever. :) > > Reviewed-by: Laszlo Ersek <ler...@redhat.com>
Indeed, I did a manual review, and posted a followup patch of several casts that can be eliminated without causing any compiler warnings. I'm still planning on committing this patch as-is (whitespace only changes) but will wait until we review that patch to make sure I'm not eliminating a cast that would otherwise serve a useful documentation purpose despite being semantically unneeded. I could also rearrange the two patches (remove unneeded casts first, then fix whitespacing on the casts that remain) if desired. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs