Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#27 Use enum for for filebuffer table indexes

closed-fixed
Kimmo Varis
None
5
2006-07-03
2006-01-20
Kimmo Varis
No

Currently there are quite a lot of code like:

    CDiffTextBuffer& sbuf = \*m\_ptBuf\[srcPane\];
    CDiffTextBuffer& dbuf = \*m\_ptBuf\[dstPane\];
    BOOL bSrcWasMod = sbuf.IsModified\(\);
    int cd\_dbegin = srcPane == 0 ? cd.dbegin0 : cd.dbegin1;
    int cd\_dend = srcPane == 0 ? cd.dend0 : cd.dend1;
    int cd\_blank = srcPane == 0 ? cd.blank0 : cd.blank1;

I'd really like it to have e.g. FILEBUF_LEFT and
FILEBUF_RIGHT instead of 0 and 1. Point is to have
constants, not numbers, so other names are welcome too.

I know 0 is for left and 1 for right, but code could
say it too.

Discussion

  • elsapo
    elsapo
    2006-01-25

    Logged In: YES
    user_id=1195173

    I vote for this too. The names don't need to be very good to
    still be lots better than "0" and "1" :) Also, I can't think
    of better names. So I vote for the ones you propose here.

     
  • Kimmo Varis
    Kimmo Varis
    2006-07-03

    • assigned_to: nobody --> kimmov
    • status: open --> closed-fixed
     
  • Kimmo Varis
    Kimmo Varis
    2006-07-03

    Logged In: YES
    user_id=631874

    I converted LocationView.cpp, LocationView.h, MergeDoc.cpp
    and MergeDoc.h to use enums (which I added to stdafx.h).

    So closing this as fixed.