Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2642: Avoid division by zero #442

Open
mhoemmen opened this issue Feb 4, 2024 · 1 comment
Open

P2642: Avoid division by zero #442

mhoemmen opened this issue Feb 4, 2024 · 1 comment

Comments

@mhoemmen
Copy link
Contributor

mhoemmen commented Feb 4, 2024

Para 12.3 of the converting constructor from layout_stride::mapping explicitly divides by zero if the leftmost resp. rightmost extent is zero.

This a general issue with other constructors as well, e.g., if padding_value is zero.

The two-parameter constructor mapping(ext, pad) has a precondition that extents_type::index-cast(pad) is greater than zero. Thus, we already check in some cases. We should consider extending these checks to all the cases, so the mappings behave reasonably.

mhoemmen added a commit to mhoemmen/cpp-proposals-pub that referenced this issue Feb 5, 2024
This is a math-font wording macro.
It replaces the repeated phrase
"the least multiple of x greater than or equal to y."
This change addresses two issues.

1. LWG requested that we replace the repeated phrase
   with a "specification macro."  We use math font
   rather than the usual all-capital-letters
   because the "macro" operates on mathematical quantities,
   not code.  (Contrast with GENERALIZED_SUM or DECAY.)

2. It attempts (at least partly) to address Issue
   ORNL#442
   by defining the meaning of this phrase when x is zero.
@mhoemmen
Copy link
Contributor Author

mhoemmen commented Feb 5, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant