Hi,
I was wondering if the gurus that hang out here had advice on the best way to handle errors. At the moment, the most straightforward way seems to be to write code like this:
DWORD res = 1; HKEY key = NULL;
res = RegOpenKeyEx(hCurrent, subkey, 0, KEY_ALL_ACCESS, &key); if (res != ERROR_SUCCESS) goto end;
.... do stuff with key here .....
res = 0; end: if (key) RegCloseKey(key); return res;
but obviously pretty much every coding guideline ever written says "don't use goto!". Given the lack of any exception handling in C, and so no try/finally, is there a better way to deal with this? I've seen a mix of styles dotted around the wine source, this seems the easiest to read. Any opionions? Don't want to start a flamewar, but there might be arguments I've not seen yet.....
thanks -mike