If a case-set is used to resolve a single variable, use a compact case-set:
Code:
iconindex = (ext.CompareNoCase(_T(".3g2") == 0)? IDI_VIDEO_ICON
: (ext.CompareNoCase(_T(".3gp")) == 0)? IDI_VIDEO_ICON
: (ext.CompareNoCase(_T(".3gp2") == 0)? IDI_VIDEO_ICON
: IDI_???_ICON;// the last item doesn't have an evaluator, but can often use a comment to clarify why this item is the last option
This also helps the efficiency of the output assembly, as "iconindex" can probably become type-cast as constant (const in C++ code).
If possible, resolve some more math:
Code:
iconindex = (!ext.CompareNoCase(_T(".3g2")) || !ext.CompareNoCase(_T(".3gp")) || !ext.CompareNoCase(_T(".3gp2")))? IDI_VIDEO_ICON
: IDI_???_ICON;
I just love optimizing boolean logic.