[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 21 14:30:12 PDT 2021


rjmccall 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.
+
----------------
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.


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