commit: ut_vector.cpp temp build fix

From: Kenneth J. Davis (jeremyd@computer.org)
Date: Fri Feb 07 2003 - 11:32:35 EST

  • Next message: Dom Lachowicz: "Commit: gnome print work"

    CVS: ----------------------------------------------------------------------
    CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
    CVS:
    CVS: Committing in .
    CVS:
    CVS: Modified Files:
    CVS: ut_vector.cpp
    CVS: ----------------------------------------------------------------------
    temp cast away const so Windows builds again

    Windows fails to build, more or less due to this commit:

    1.45 hippietrail Feb 4 00:12
    UT_Vector::addItem methods now take const void * to diminish the need
    for casting.

    The exact error message is:

    ut_vector.cpp(146) : error C2440: '=' : cannot convert from 'const void *' to 'void *'
            Conversion loses qualifiers

    The problem is that line 146
            m_pEntries[m_iCount++] = p;
    is assigning a now (const void *) to a (void *).

    Now I could just cast away the constness, but that seems bad.
    I could also change m_pEntries to be an array of (const void *),
    but then the constness would have to be cast away when an item
    is retrieved (a least for some items).

    So my question for C++ experts out there, how best should I fix this?
    Should I just cast away the constness and live with it, or
    can you suggest a more palatable way to correct the build?

    In the meantime this patch casts (C style to hopefully force
    someone to reply) the (const void *) to a (void *) and lets the
    build proceed.

    Thank you,
    Jeremy



    This archive was generated by hypermail 2.1.4 : Fri Feb 07 2003 - 11:37:12 EST