I found the following curious usage. Does anyone think it is wrong.The code is taking and Element and casting it to Chord* before checking its element type.I would think the static_cast<chord*> and the if ( ... chord-.tupe() != Element::Type::CHORD) continueshould be reversed? Am I confused?void Score::createPlayEvents() { int etrack = nstaves() * VOICES; for (int track = 0; track < etrack; ++track) { int mn=0; for (Measure* m = firstMeasure(); m; mn++, m = m->nextMeasure()) { // skip linked staves, except primary if (!m->score()->staff(track / VOICES)->primaryStaff()) continue; const Segment::Type st = Segment::Type::ChordRest; for (Segment* seg = m->first(st); seg; seg = seg->next(st)) { Chord* chord = static_cast<Chord*>(seg->element(track)); // curious line order if (chord == 0 || chord->type() != Element::Type::CHORD) // curious line order continue; createPlayEvents(chord); } } } }
-- View this message in context: http://dev-list.musescore.org/funny-use-of-static-cast-tp7579351.html Sent from the MuseScore Developer mailing list archive at Nabble.com. ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Mscore-developer mailing list Mscore-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mscore-developer