[spam] software responsibility
Karl
gmkarl at gmail.com
Thu Nov 4 13:06:24 PDT 2021
1543
let's review this patch history again. with longer output context. and
the knowledge that static memory is zero-initialised whether you want this
or not.
1550
let's review this patch history again.
1553
so the default context reuse is right at the top of the function. if there
is one, it bumps the refcount, points and returns, everything's good
libusb_init locks around a global lock, so things in it are not
simultaneous.
the check if (ctx || !usbi_default_context) ... I think this is saying to
only execute the block if a new context is being made? but isn't that
always true? it replaced if (!ctx) which says, only if this is the default
context.
let's see if the block is always true.
if ctx is nonzero, that's the normal case. then edge cases would be ctx is
zero.
if ctx is zero, then there's a block that checks for usbi_default_context
being nonzero, and short-circuits, returning.
so, after that block, usbi_default_context is zero if ctx is zero.
therefore, ctx || !usbi_default_context ....
uhh is saying ctx || (!ctx && !usbi_default_context)
and we just said that those two being zero, one implies the other
so ctx || !ctx, it would always be true.
hard to verify. 4 cases, 4 combinations of nonzeroness.
1 is eliminated by the short-circuit: !ctx, +dflt
leaves 3: ctx, dflt; ctx, !dflt; !ctx, !dflt
1601
1603
boolean logic! woot! oh man my whole universe is partial truth tables
right now
omigod trues and falses, everywhere
I just so badly want to question whether true is _really_ true, or false
_really_ false. could a 1 or a 0 be a trick? you never know!
!ctx, dflt <- eliminated by short circuit?
remaining? -> ctx, dflt; ctx, !dflt; !ctx, !dflt
1606
suddenly taking a break
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/html
Size: 2925 bytes
Desc: not available
URL: <https://lists.cpunks.org/pipermail/cypherpunks/attachments/20211104/cb499442/attachment.txt>
More information about the cypherpunks
mailing list