[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation
Saurabh Jha via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 22 00:28:57 PDT 2021
SaurabhJha added inline comments.
================
Comment at: clang/docs/MatrixTypes.rst:279
+The number of constituent arrays must equal the number rows in the matrix type M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+
----------------
rjmccall wrote:
> This is contradicted by your first example. I think you want to say something like
>
> > A value of matrix type `M` can be initialized with an initializer list:
> >
> > (examples)
> >
> > If the initializer list is empty, all elements of the matrix are zero-initialized. Otherwise, the initializer list must consist of `M::rows` initializer lists, each of which must consist of `M::columns` expressions, each of which is used to initialize the corresponding element of the matrix (that is, `m[i][j]` is initialized by the `j`th expression of the `i`th initializer list in the initializer). Element designators are not allowed.
>
> That's assuming you want to allow `{}`, but I think that's probably a good idea. At the very least, you already have to define how objects of static storage duration are zero-initialized, and having a way to do that explicitly always seems wise to me.
That sounds great @rjmccall, thanks for your suggestions.
I think I got confused between whether to allow `{}` but as you suggested, I think we should.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106005/new/
https://reviews.llvm.org/D106005
More information about the cfe-commits
mailing list