Skip to main content

Timeline for Simple stack of integers

Current License: CC BY-SA 4.0

13 events
when toggle format what by license comment
Jan 25, 2023 at 13:49 history edited Davislor CC BY-SA 4.0
added 41 characters in body
Jan 25, 2023 at 7:52 comment added Toby Speight Ah, Annex K. Ugh! Yes, it's K.3.3 in C17. Thanks for the pointer.
Jan 25, 2023 at 7:27 comment added Davislor @TobySpeight It’s in the optional Annex K of C11, I believe.
Jan 25, 2023 at 6:50 comment added Toby Speight That was in response to the second paragraph under "Use the Right Type for Size and Index Values." But I think you used the word "wraparound" differently to what I understood. (I know nothing about Microsoft platforms, and haven't seen a proposal for that type in standard C).
Jan 25, 2023 at 6:44 comment added Davislor @TobySpeight The fact is, it’s hard. I caught three bugs in the memory-management after I posted, one of which was that I hadn’t tested whether the size of my memory allocation overflows.
Jan 25, 2023 at 6:42 comment added Davislor @TobySpeight I’m not completely sure what line you’re responding to. If you mean the use of a signed size value, the idea there is that it will catch wraparound from below, but not from above. However, Microsoft did create an unsigned type to handle wraparound in both directions, rsize_t.
Jan 25, 2023 at 6:34 comment added Toby Speight Oh, perhaps you were talking of underflow (passing zero, rather than exceeding max). That's different, and not a problem.
Jan 25, 2023 at 6:33 comment added Toby Speight Note that the obvious way of using "a signed value, to check for wraparound" is Undefined Behaviour, and the correct way to check for overflow is to check before the arithmetic (or possibly to use compiler extensions such as signalling saturating arithmetic).
Jan 25, 2023 at 4:58 history edited Davislor CC BY-SA 4.0
added 86 characters in body
Jan 25, 2023 at 3:42 history edited Davislor CC BY-SA 4.0
deleted 127 characters in body
Jan 25, 2023 at 1:57 history edited Davislor CC BY-SA 4.0
added 14 characters in body
Jan 24, 2023 at 22:48 history edited Davislor CC BY-SA 4.0
Fixed embarrassing bug that would’ve caused a buffer overrun.
Jan 24, 2023 at 22:21 history answered Davislor CC BY-SA 4.0