corinthia-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jan i <j...@apache.org>
Subject Re: Operations.c: DFGet() called from consumers/dfconvert/main.c
Date Mon, 04 May 2015 15:17:51 GMT
On 4 May 2015 at 17:02, Gabriela Gibson <gabriela.gibson@gmail.com> wrote:

> In that case, I'll chance 'success' to 'ok', because that preserves
> uniformity (and it's shorter too :)
>
> Whilst it seems like a small thing, I personally find consistency makes
> skim reading much easier and quicker, the less one has to read(and parse),
> the more brain space is left for thinking.
>
you are quite right here....but you will find that programmers are "lazy"
and do not use the names they should use.

Thanks for correcting this. Even though I am less active online at the
moment (I am caught up in a battle in some higher levels, which actually
might end up changing a lot for me personally), I still follow what is
happening actively, and it pleased me a lot to see that you started digging
into ODF:

Keep up the good work !!
rgds
jan I.


>
> G
>
> On Mon, May 4, 2015 at 3:13 PM, Peter Kelly <pmkelly@apache.org> wrote:
>
> > > On 4 May 2015, at 8:39 pm, Gabriela Gibson <gabriela.gibson@gmail.com>
> > wrote:
> > >
> > > On Mon, May 4, 2015 at 2:09 PM, Franz de Copenhague <
> > > franzdecopenhague@outlook.com> wrote:
> > >
> > >> ----------------------------------------
> > >>> Date: Mon, 4 May 2015 07:59:31 +0200
> > >>> Subject: Re: Operations.c: DFGet() called from
> > consumers/dfconvert/main.c
> > >>> From: jani@apache.org
> > >>> To: dev@corinthia.incubator.apache.org
> > >>>
> > >>> On Monday, May 4, 2015, Gabriela Gibson <gabriela.gibson@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
> > pmkelly@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)
> >
> >
>
>
> --
> Visit my Coding Diary: http://gabriela-gibson.blogspot.com/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message