2026/04/03

Newest at the top

2026-04-03 21:56:07 +0000merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2026-04-03 21:48:49 +0000merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) merijn
2026-04-03 21:47:55 +0000 <tomsmeding> same for clang 21.1.6
2026-04-03 21:47:07 +0000 <tomsmeding> monochrom: I do not share your observations, I get no -Wunused-result for read(2) whatsoever on my system (linux, gcc 15.2.1), but I do get that warning for realloc() regardless of the optimisation level
2026-04-03 21:47:05 +0000 <monochrom> When confronted with an unused-value problem, some people go, "I know, I will store it in a fresh variable!". Now they have two problems. >:)
2026-04-03 21:44:41 +0000 <tomsmeding> monochrom: although now you have a -Wunused-but-set-variable ;)
2026-04-03 21:44:00 +0000 <tomsmeding> yes, I'm a little confused too
2026-04-03 21:43:41 +0000 <monochrom> Adding "int r; r =" kills the warning under -O2. So it is not even like "we need an elaborate live-variable analysis to discover unused results" :)
2026-04-03 21:37:56 +0000synchromesh(~john@2406:5a00:2412:2c00:343e:4e23:bce:73a3) synchromesh
2026-04-03 21:36:55 +0000merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2026-04-03 21:36:19 +0000 <tomsmeding> I guess https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result is the better link
2026-04-03 21:35:53 +0000synchromesh(~john@2406:5a00:2412:2c00:343e:4e23:bce:73a3) (Read error: Connection reset by peer)
2026-04-03 21:35:52 +0000 <tomsmeding> the manual doesn't elucidate: https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-warn_005funused_005fresult
2026-04-03 21:35:14 +0000 <monochrom> So I still don't know why! :)
2026-04-03 21:34:41 +0000 <monochrom> No warning until -O2
2026-04-03 21:34:32 +0000 <monochrom> OK I have: int main(void) {char b[100]; read(0, b, 100); ...
2026-04-03 21:33:22 +0000 <tomsmeding> not saying there are none, I just can't think of any :)
2026-04-03 21:32:44 +0000 <tomsmeding> that... has nothing to do with optimisations? fork() doesn't care whether you used -O2 if it wants to fail
2026-04-03 21:32:11 +0000 <monochrom> I forgot. I seem to recall that unused-return-value is one of them.
2026-04-03 21:31:42 +0000merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) merijn
2026-04-03 21:31:37 +0000 <tomsmeding> warning about = vs == is independent of optimisations
2026-04-03 21:31:21 +0000 <tomsmeding> what kind of warnings would become more important under optimisations?
2026-04-03 21:31:00 +0000 <monochrom> At least there is a strong correlation between unoptimized and bad code working fine.
2026-04-03 21:30:54 +0000 <tomsmeding> ideologically it's a little more nuanced
2026-04-03 21:30:36 +0000 <tomsmeding> observationally, yes
2026-04-03 21:30:27 +0000 <monochrom> Ah OK. I think the two are logically equivalent. :)
2026-04-03 21:30:20 +0000 <tomsmeding> but this is from memory -- not 100% sure
2026-04-03 21:30:04 +0000 <tomsmeding> or, reformulated, they think it's not worth generating the warnings if that's the only reason for running the analysis
2026-04-03 21:29:57 +0000 <monochrom> I was guessing that it was because -O2 breaks more code under beginner mistakes.
2026-04-03 21:29:44 +0000 <tomsmeding> IIRC some of the analyses needed to produce the warnings are only computed for the benefit of particular optimisations
2026-04-03 21:29:21 +0000 <monochrom> I don't know. Is that it?
2026-04-03 21:29:07 +0000 <tomsmeding> isn't that to make ghc -O0 faster?
2026-04-03 21:28:44 +0000 <monochrom> gcc -O2 turns on more warnings than -O0. Anyone want to bring that ideology to GHC? Maybe next April 1? >:)
2026-04-03 21:25:03 +0000 <monochrom> OK I like -W now. Didn't know that it exists.
2026-04-03 21:24:00 +0000Square3(~Square@user/square) Square
2026-04-03 21:21:43 +0000absurdvoid(~absurdvoi@user/absurdvoid) absurdvoid
2026-04-03 21:20:42 +0000merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 255 seconds)
2026-04-03 21:20:23 +0000Guest20(~Guest20@149.3.7.235)
2026-04-03 21:19:55 +0000absurdvoid(~absurdvoi@user/absurdvoid) (Ping timeout: 268 seconds)
2026-04-03 21:16:56 +0000 <tomsmeding> (I just wrote one)
2026-04-03 21:16:55 +0000 <monochrom> But most importantly, the OOP world did not freak out and added -Wunused-return-value to their -Wall.
2026-04-03 21:16:28 +0000 <tomsmeding> ah, and 8% of the remaining cases are forkIO
2026-04-03 21:16:13 +0000 <monochrom> `char` returning the character you already know is a nicety that you have the full right to use or ignore. SImilarly to in the OOP world most methods return this so you can chain o.m1().m2().m3(). (Especially popular among the JS people.)
2026-04-03 21:15:50 +0000 <tomsmeding> well that explains :p
2026-04-03 21:15:43 +0000 <tomsmeding> nice
2026-04-03 21:15:39 +0000merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) merijn
2026-04-03 21:15:35 +0000 <geekosaur> along with a lot of example code which assumed `-Wunused-do-bind` didn't exist
2026-04-03 21:15:03 +0000 <tomsmeding> adding a _ to a mapM is really not the problem
2026-04-03 21:14:44 +0000 <geekosaur> parsec by a decade, I think
2026-04-03 21:14:41 +0000 <tomsmeding> because in my (mostly pointless) following of -Wunused-do-bind in my code, 90% of the annoying cases where I add a pointless `_ <-` are for `char`