> On 4 May 2015, at 8:39 pm, Gabriela Gibson <gabriela.gib...@gmail.com> wrote: > > On Mon, May 4, 2015 at 2:09 PM, Franz de Copenhague < > franzdecopenha...@outlook.com> wrote: > >> ---------------------------------------- >>> Date: Mon, 4 May 2015 07:59:31 +0200 >>> Subject: Re: Operations.c: DFGet() called from consumers/dfconvert/main.c >>> From: j...@apache.org >>> To: dev@corinthia.incubator.apache.org >>> >>> On Monday, May 4, 2015, Gabriela Gibson <gabriela.gib...@gmail.com> >> wrote: >>> >>>> >>>> I also would like to rename int r = 0; to the (a little more obvious) >> int >>>> success = 0; >>>> >>>> What do you think? >>> >>> sounds logical to me. >> >> To keep the semantics you can do r = SUCCESS instead of r = 0; and define >> SUCCESS somewhere >> >> That would be a global decision --- and I think quite a good one, since > this kind of pattern will come up a number of times in the code and it's > nice to have uniformity. > > I'm not sure in which header file this would live in, so that it can be > found everywhere. > > What does everyone think about this?
I think naming the variable to ‘success’ would be the better of the two. This is the same semantics, just more obvious to the reader. I’ve used the name ‘ok’ in a number of places as it’s shorter to type, but either name is clear. A SUCCESS constant introduces the risk that someone might write: if (r == SUCCESS) which is incorrect, as in C any non-zero value is considered to be true. The following is clearer: if (success) or if (ok) See the WordGet function in DocFormats/filters/ooxml/src/word/Word.c for an example. — Dr Peter M. Kelly pmke...@apache.org PGP key: http://www.kellypmk.net/pgp-key <http://www.kellypmk.net/pgp-key> (fingerprint 5435 6718 59F0 DD1F BFA0 5E46 2523 BAA1 44AE 2966)