4 ms·
#2 is horrid, but could be solved by inverted if conditions and a single “cleanup:” label with goto: if (!SUCCEEDED(hr)) goto cleanup;
by colejohnson66 5y ago
#2 is horrid, but could be solved by inverted if conditions and a single “cleanup:” label with goto:
if (!SUCCEEDED(hr))
goto cleanup;
- benibela 5y agoOr: if (SUCCEEDED(pfd->Advise(pfde, &dwCookie)) && SUCCEEDED(pfd->GetOptions(&dwFlags)) && SUCCEEDED(pfd->SetOptions(dwFlags | FOS_FORCEFILESYSTEM)) && SUCCEEDED(pfd->SetFileTypes(ARRAYSIZE(c_rgSaveTypes), c_rgSaveTypes)) && ... )
- userbinator 5y agoThe point is that all those function calls aren't necessary, nor could the majority of them ever fail. Assigning to a field in a structure doesn't fail nor result in a function call.