[tim-janik/beast] BSE: bse_cast - an API suggestion of how to handle bse object casts (#34)

During fixes for #32 #24 you introduced manual null pointer checks for as<TrackIfaceP> and so on. I don't believe that this is the best approach; so I here is a suggestion of how I think it should be done.

I would recommend replacing each invocation of as<> with bse_cast<>, even if in some cases this will be a little longer:

casting track object
old: track ? track->as<TrackIfaceP>() : NULL;
new: bse_cast<TrackIfaceP> (track);

casting this object
old: as<TrackIfaceP>();
new: bse_cast<TrackIfaceP> (this);

However, I still think my version is the better API, because

Its a bit of work to do the details and replace all cases where this is used, but if you want to go this way, I can provide a complete patch which eliminates as<>() completely.

You can view, comment on, or merge this pull request online at:


Commit Summary

File Changes

Patch Links:

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]