cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://botbot.me/freenode/pypy/ ) | use cffi for calling C | the secret reason for us trying to get PyPy users: to test the JIT well enough that we're somewhat confident about it
<cfbolz>
arigato: I don't understand the warning and I always feel unsure about C, so I wanted a second pair of eyes
<arigato>
yes
<cfbolz>
ok
<arigato>
go ahead
<cfbolz>
any clue what the warning is about? why is a multiplication in a boolean context dangerous?
<kenaan>
cfbolz default 8e52e1e16d7c /pypy/module/cpyext/include/pymem.h: silence a GCC int-in-bool-context warning this is equivalent to the fix of CPython issue https://bugs.python.org/...
<arigato>
it's because the macro expands to: realloc(p, (new_allocated * sizeof(type)) ? (new_allocated * sizeof(type)) : 0)
<arigato>
it's strange like "if (a * b) { .. }"
<arigato>
because it's basically the same as "if (a && b) { .. }"
<cfbolz>
right
<cfbolz>
thanks
<arigato>
I imagine that the warning is also for people who write "if (a * b)" assuming that for some large values of a and b, the multiplication overflows to 0
<arigato>
and it's exactly the case that they want to test
<arigato>
so the warning instead makes it clear that it's not going to work, because gcc assumes signed integer arithmetic doesn't overflow
<cfbolz>
arigato: right. and for the context of a macro where the multiplication appears in two places that makes no sense, of course
<cfbolz>
but poor GCC can't know
<arigato>
it's also a warning that the macro realloc(p, (n)?(n):1) is not enough to ensure that realloc is never called with 0
<arigato>
because the value of n can overflow to 0 in computations, but gcc assumes it was never zero, and so it doesn't check the result
<cfbolz>
argh
<cfbolz>
C sure is fun
<arigato>
"yes"
<cfbolz>
:-)
<kenaan>
cfbolz default 7c772420134d /pypy/module/: declare array.array to be a read-write buffer. Fixes issue #2751
tayfun26 has quit [Quit: tayfun26]
squeaky_pl has quit [Ping timeout: 252 seconds]
drolando has quit [Remote host closed the connection]
drolando has joined #pypy
<tos9>
qui
dustinm- has joined #pypy
jacob22__ has joined #pypy
demonimin_ has joined #pypy
demonimin_ has joined #pypy
gclawes has joined #pypy
mdash_ has joined #pypy
Knio_ has joined #pypy
Graypup__ has joined #pypy
Hotpot33_ has joined #pypy
dan-- has joined #pypy
dan-- has joined #pypy
dan-- has quit [Changing host]
jacob22_ has quit [*.net *.split]
Hotpot33 has quit [*.net *.split]
dan- has quit [*.net *.split]
mdash has quit [*.net *.split]
demonimin has quit [*.net *.split]
dustinm has quit [*.net *.split]
alcarith1 has quit [*.net *.split]
gclawes_ has quit [*.net *.split]
jmcp has quit [*.net *.split]
Knio has quit [*.net *.split]
Graypup_ has quit [*.net *.split]
Jonno_FTW has quit [*.net *.split]
trfl has quit [*.net *.split]
trfl has joined #pypy
Jonno_FTW has joined #pypy
dan-- is now known as dan-
tos9 has quit [Ping timeout: 260 seconds]
tos9 has joined #pypy
alcarith1 has joined #pypy
lritter has joined #pypy
fryguybob has joined #pypy
<nanonyme>
arigato, thanks a lot for the CFFI release again, just took it into use today