Newest at the top
2024-11-05 20:13:07 +0100 | <tomsmeding> | are any free? |
2024-11-05 20:12:56 +0100 | <dolio> | I assume 2018 still isn't free? |
2024-11-05 20:12:26 +0100 | <tomsmeding> | er -- I said "9.2.5 paragraph 9" but that was a typo/thinko, should have been 6.2.5 par 9, clearly |
2024-11-05 20:11:59 +0100 | <monochrom> | Hrm maybe I should also download the C11 and other versions. (University grants access.) |
2024-11-05 20:11:40 +0100 | <tomsmeding> | (though I found it in C11 -- apparently the section numbering didn't change significantly from C11 to C18?) |
2024-11-05 20:11:20 +0100 | <tomsmeding> | we found it :) |
2024-11-05 20:11:12 +0100 | <monochrom> | BTW the unsigned modulo rule is (in C 2018) 6.2.5 item 9. |
2024-11-05 20:08:31 +0100 | <tomsmeding> | well, I guess index arithmetic could be unsigned integer arithmetic, but it's _signed_ integer arithmetic in practice in C |
2024-11-05 20:08:10 +0100 | <tomsmeding> | and people have array accesses in the dependency chain (how is that called again?) in hot loops, but usually not unsigned integer arithmetic :p |
2024-11-05 20:07:57 +0100 | <Rembane> | Good point. Then that instruction shouldn't be too heavy. |
2024-11-05 20:07:31 +0100 | <tomsmeding> | bounds checking typically involves more than 1 instruction, perhaps even a memory load for the size of the array |
2024-11-05 20:06:46 +0100 | <tomsmeding> | a very predictable branch, at that, so while it does increase your code size and increases the pressure on the branch predictor cache, it won't be _too_ egregious |
2024-11-05 20:06:10 +0100 | <tomsmeding> | x86 has an overflow (! naming ._.) flag that you can check for with a single conditional branch instruction |
2024-11-05 20:06:04 +0100 | <Rembane> | tomsmeding: Sweet. Maybe I have mixed it up with actually doing bounds checking before the fact. |
2024-11-05 20:05:55 +0100 | ZLima12 | (~zlima12@user/meow/ZLima12) ZLima12 |
2024-11-05 20:05:47 +0100 | <tomsmeding> | Rembane: depends on the cpu, I think |
2024-11-05 20:05:35 +0100 | <Rembane> | tomsmeding: But IIRC that's super slow. |
2024-11-05 20:05:31 +0100 | <Rembane> | tomsmeding: I think I'm more of the trapping school. |
2024-11-05 20:05:17 +0100 | <tomsmeding> | I guess the only other sensible alternative is trapping |
2024-11-05 20:05:17 +0100 | <dolio> | (And just searching for "overflow" in the document has too many hits.) |
2024-11-05 20:05:07 +0100 | <tomsmeding> | Rembane: unsigned integers wrapping? What alternative would you suggest :p |
2024-11-05 20:04:43 +0100 | <Rembane> | tomsmeding: Lovely! Fun! I can't see how that every could go wrong. :D |
2024-11-05 20:03:44 +0100 | <tomsmeding> | heh |
2024-11-05 20:03:40 +0100 | <dolio> | So if you look in the index for overflow, you won't get that page, I expect. |
2024-11-05 20:03:37 +0100 | <tomsmeding> | I guess also Rembane |
2024-11-05 20:03:25 +0100 | <tomsmeding> | c_wraith: ^ |
2024-11-05 20:03:20 +0100 | <tomsmeding> | I agree it's somewhat confusing terminology |
2024-11-05 20:02:48 +0100 | <dolio> | It's defined to be modular arithmetic. And apparently the reason I was having trouble is that C considers that to not be "overflow". |
2024-11-05 20:02:38 +0100 | <tomsmeding> | here (C11 draft: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf ) I find, in section 9.2.5 paragraph 9: "A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type." |
2024-11-05 20:01:46 +0100 | <dolio> | Oh okay. Yeah. |
2024-11-05 20:01:07 +0100 | AWizzArd | (~code@user/awizzard) AWizzard |
2024-11-05 20:01:07 +0100 | AWizzArd | (~code@gehrels.uberspace.de) (Changing host) |
2024-11-05 20:00:55 +0100 | <tomsmeding> | dolio: I suppose you have a physical copy? With a digital one, I would search for the quoted "a computation involving unsigned operands can never overflow" |
2024-11-05 19:59:55 +0100 | <dolio> | I think that's probably the one I have, but they only appear to cite the entire document. |
2024-11-05 19:59:24 +0100 | longlongdouble | (~longlongd@2405:201:5c16:135:7459:cd00:c885:3805) (Ping timeout: 276 seconds) |
2024-11-05 19:58:52 +0100 | TheCoffeMaker | (~TheCoffeM@user/thecoffemaker) TheCoffeMaker |
2024-11-05 19:57:59 +0100 | SlackCoder | (~SlackCode@64-94-63-8.ip.weststar.net.ky) SlackCoder |
2024-11-05 19:57:59 +0100 | TheCoffeMaker | (~TheCoffeM@user/thecoffemaker) (Remote host closed the connection) |
2024-11-05 19:56:18 +0100 | BolzmannPain | (~BolzmannP@user/BolzmannPain) (Quit: Client closed) |
2024-11-05 19:55:56 +0100 | SlackCoder | (~SlackCode@64-94-63-8.ip.weststar.net.ky) (Quit: Leaving) |
2024-11-05 19:50:29 +0100 | <tomsmeding> | it refers to C11 |
2024-11-05 19:50:25 +0100 | <tomsmeding> | the wikipedia article has a citation, perhaps that helps? |
2024-11-05 19:50:14 +0100 | <dolio> | I probably don't know what term to search for. |
2024-11-05 19:49:55 +0100 | <tomsmeding> | dolio++ for even trying |
2024-11-05 19:49:25 +0100 | <dolio> | I tried to look in my copy of the standard, but it's hard to find stuff in there. |
2024-11-05 19:45:48 +0100 | TheCoffeMaker | (~TheCoffeM@user/thecoffemaker) TheCoffeMaker |
2024-11-05 19:44:52 +0100 | TheCoffeMaker | (~TheCoffeM@user/thecoffemaker) (Quit: So long and thanks for all the fish) |
2024-11-05 19:37:15 +0100 | Nachtgespenst | (~user@user/siracusa) (Quit: Bye!) |
2024-11-05 19:18:21 +0100 | BolzmannPain | (~BolzmannP@user/BolzmannPain) BolzmannPain |
2024-11-05 19:18:18 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |