From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason at zx2c4.com (Jason A. Donenfeld) Date: Thu, 16 Jan 2014 01:20:15 +0100 Subject: Policy on global variables In-Reply-To: References: Message-ID: 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