This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy


/* A very C-style error trapping mechanism. */



Download 21,46 Mb.
Pdf ko'rish
bet450/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   446   447   448   449   450   451   452   453   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

/* A very C-style error trapping mechanism. */

#define E_FILENOTFOUND 1000

int SomeFunction()

{

// Assume something happens in this f(x)



// that causes the following return value.

return E_FILENOTFOUND;

}

void main()



{

int retVal = SomeFunction();

if(retVal == E_FILENOTFOUND)

printf("Cannot find file...");

}

This approach is less than ideal, given the fact that the constant E_FILENOTFOUND is little more



than a numerical value, and is far from being a helpful agent regarding how to deal with the prob-

lem. Ideally, you would like to wrap the error’s name, a descriptive message, and other helpful

information regarding this error condition into a single, well-defined package (which is exactly

what happens under structured exception handling).

In addition to a developer’s ad hoc techniques, the Windows API defines hundreds of error

codes that come by way of #defines, HRESULTs, and far too many variations on the simple Boolean

(bool, BOOL, VARIANT_BOOL, and so on). Also, many C++ COM developers (and indirectly, many VB6

COM developers) have made use of a small set of standard COM interfaces (e.g., ISupportErrorInfo,

IErrorInfo, ICreateErrorInfo) to return meaningful error information to a COM client.

The obvious problem with these previous techniques is the tremendous lack of symmetry. Each

approach is more or less tailored to a given technology, a given language, and perhaps even a given

project. In order to put an end to this madness, the .NET platform provides a standard technique to

send and trap runtime errors: structured exception handling (SEH).

C H A P T E R   7  




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   446   447   448   449   450   451   452   453   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish