On Thu, Apr 3, 2025 at 8:10 PM Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > On Thu, 3 Apr 2025 at 10:21, Mateusz Guzik <mjguzik@xxxxxxxxx> wrote: > > > > I would argue it would be best if a language wizard came up with a way > > to *demand* explicit use of { } and fail compilation if not present. > > I tried to think of some sane model for it, but there isn't any good syntax. > > The only way to enforce it would be to also have a "end" marker, ie do > something like > > scoped_guard(x) { > ... > } end_scoped_guard; > > and that you could more-or-less enforce by having > > #define scoped_guard(..) ... real guard stuff .. \ > do { > > #define end_scope } while (0) > Ye I was thinking about something like that would was thoroughly dissatisfied with the idea. Perhaps a tolerable fallback would be to rely on checkpatch after all, but have it detect missing { } instead of relying on indentation level? -- Mateusz Guzik <mjguzik gmail.com>