[PATCH] D82594: Clarify a bit the guideline on omitting braces, including more examples (NFC)

Chris Lattner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 18:00:49 PDT 2020


lattner added a comment.

In D82594#2131998 <https://reviews.llvm.org/D82594#2131998>, @MaskRay wrote:

> In D82594#2131989 <https://reviews.llvm.org/D82594#2131989>, @lattner wrote:
>
> > I'm not sure what the contention here is.  `int` is a clearly inferior choice and is just as unprincipled as `unsigned` is, we should use the correct type.
> >
> > I get the sense that you're arguing for `ssize_t` or one of its analogues instead of `size_t`? Are you arguing for general principles or this specific case?  In this specific case, using `size_t` seems completely reasonable, but I agree that `ssize_t` would also be fine.
> >
> > I'm ok with either size_t or ssize_t here, but if you want to turn this into a general principle that we apply to the code base, then it should be discussed on llvm-dev first.
>
>
> ssize_t is inferior. POSIX.1-2017 says "The type ssize_t shall be capable of storing values at least in the range [-1, {SSIZE_MAX}]." The implementation may not even support -2.
>
> We could also use intptr_t to avoid sign extension on a 64-bit machine.


Well sure, but C and POSIX are designed to support non-2's complement and other weird machines.  LLVM wouldn't run in general on a machine that weird.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82594/new/

https://reviews.llvm.org/D82594





More information about the llvm-commits mailing list