← Back to team overview

kicad-developers team mailing list archive

Re: Build faulure

 

Hi,

> I’ve changed the probably-offending line back to a static_cast, but I can’t say I’m terribly happy about it.  dynamic_cast would be safer….

We have a few more of these in the codebase, around GetElem() calls.

common/project.cpp:    FP_LIB_TABLE*   tbl = (FP_LIB_TABLE*) GetElem( ELEM_FPTBL );
eeschema/sch_edit_frame.cpp:    SEARCH_STACK* ss = (SEARCH_STACK*) GetElem( PROJECT::ELEM_SCH_SEARCH_STACK );
eeschema/sch_edit_frame.cpp:    wxASSERT( !ss || dynamic_cast<SEARCH_STACK*>( GetElem( PROJECT::ELEM_SCH_SEARCH_STACK ) ) );
eeschema/sch_edit_frame.cpp:    PART_LIBS* libs = (PART_LIBS*) GetElem( PROJECT::ELEM_SCH_PART_LIBS );
eeschema/project_rescue.cpp:    PART_LIBS *libs = dynamic_cast<PART_LIBS*>( m_prj->GetElem( PROJECT::ELEM_SCH_PART_LIBS ) );
eeschema/eeschema_config.cpp:    SYMBOL_LIB_TABLE* tbl = (SYMBOL_LIB_TABLE*) GetElem( ELEM_SYMBOL_LIB_TABLE );
3d-viewer/3d_cache/3d_cache_wrapper.cpp:    CACHE_WRAPPER* cw = (CACHE_WRAPPER*) GetElem( ELEM_3DCACHE );
pcbnew/pcb_base_frame.cpp:    FP_LIB_TABLE*   tbl = (FP_LIB_TABLE*) GetElem( ELEM_FPTBL );

Some of these have been converted to dynamic_cast<> already, but converting all of them causes similar problems.

   Simon


References