You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suggest that it should be stated explicitly whether bit registers or statically-sized arrays of size 0 are allowed by the spec.
Since it is not currently mentioned, I believe that registers with zero bits should be supported, but qe-qasm does not currently support them: openqasm/qe-qasm#37.
For what it's worth, a zero-sized array on the stack is disallowed in C by the standard. However, I think there is a stronger case for allowing them in OpenQASM, for two reasons:
An unused empty array in a C can be eliminated from the code and replaced with NULL without the semantics of that code changing, AFAICT. By contrast, removing an output array register of zero bits from an OpenQASM program would change the result; the register would no longer be included in the output.
OpenQASM code is often generated by a computer program, and the output is typically consumed by a computer program. Running a program, with certain inputs, might sometimes result in a classical register of zero size, and it would be nice not to have to special case this both when the OpenQASM is generated and when the output is consumed.
If it is decided instead that arrays of size 0 should not be allowed, then I suggest that it be clarified that every dimension of the array must be at least 1 (e.g., array[float[32], 3, 0, 2] would contain zero elements and therefore also be disallowed).
The text was updated successfully, but these errors were encountered:
From my opinion a zero-size register feels fine for the 2 reasons given. If you u are able to PR to implement the spec change, it will be easier to validate.
What is the expected enhancement?
I suggest that it should be stated explicitly whether bit registers or statically-sized arrays of size 0 are allowed by the spec.
Since it is not currently mentioned, I believe that registers with zero bits should be supported, but qe-qasm does not currently support them: openqasm/qe-qasm#37.
For what it's worth, a zero-sized array on the stack is disallowed in C by the standard. However, I think there is a stronger case for allowing them in OpenQASM, for two reasons:
NULL
without the semantics of that code changing, AFAICT. By contrast, removing an output array register of zero bits from an OpenQASM program would change the result; the register would no longer be included in the output.If it is decided instead that arrays of size 0 should not be allowed, then I suggest that it be clarified that every dimension of the array must be at least 1 (e.g.,
array[float[32], 3, 0, 2]
would contain zero elements and therefore also be disallowed).The text was updated successfully, but these errors were encountered: