From: Jason at zx2c4.com (Jason A. Donenfeld)
Subject: Policy on global variables
Date: Thu, 16 Jan 2014 01:20:15 +0100 [thread overview]
Message-ID: <CAHmME9qdgqougGrSJnx2caRxL2p9DTSZyJMMVxfXw0B4Fxun0A@mail.gmail.com> (raw)
In-Reply-To: <CAHmME9rKGfPx6ppX3VtN06Cd0YpAGCuzM4WW5A-sg7i3q6ZoTg@mail.gmail.com>
A stranger, "bone" in ##c on freenode:
At first:
bone: "do you not care about reentrancy?"
...
After some discussion:
bone: given the practical considerations, you'll probably introduce
bugs by passing a context around, so you might as well leave it until
you actually need reentrancy. but i would try to refactor the code
functions that only need a subset of data can be passed that without
needing the whole context. then later you can change the upper level
functions to receive a context instead of using a static
me: so the first step, move to all global. then later on, refactor
things to pass a reference around, but to less places?
bone: yeah, presumably you have some functions that are only called by
one parent function, so they only do a subset of the work, and if they
can work on data from the context via parameters instead of
implicitly, all the better. then the parent can update the context as
needed, eventually you can reduce the number of accesses to the
context, then the move to passing the context around becomes much
easier implement
next prev parent reply other threads:[~2014-01-16 0:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 0:06 Jason
2014-01-16 0:20 ` Jason [this message]
2014-01-16 0:59 ` normalperson
2014-01-16 1:00 ` Jason
2014-01-16 8:06 ` hjemli
2014-01-16 10:47 ` normalperson
2014-01-16 11:31 ` Jason
2014-01-16 13:08 ` john
2014-01-16 18:38 ` Jason
2014-01-16 21:21 ` john
2014-01-16 21:26 ` Jason
2014-01-16 21:34 ` john
2014-01-16 21:36 ` Jason
2014-01-16 22:20 ` john
2014-01-16 23:42 ` Jason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHmME9qdgqougGrSJnx2caRxL2p9DTSZyJMMVxfXw0B4Fxun0A@mail.gmail.com \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).