Win32

In the world of Win32, integer values were used to indicate errors produced by functions. This already introduces a problem: The meaning of a plain old integer is not very clear by just looking at it. Instead, symbolic constants need to be introduced to make program code look more meaningful. Furthermore, those error codes need to be queried for manually after failed function calls using the GetLastError function. An example of such a function call, followed by error “handling,” is shown here:

image

Combined with manual resource management, propagation of errors typically leads to the use of goto statements to jump to an epilogue in the containing ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.