Taking http get as an example, you need to go to the server to get the webpage content. To prevent errors, retry three times and throw an exception when the last retry fails. We will ignore the previous two exceptions. In C #, it is usually processed as follows: For (INT I = 0; I <3; I ++) {try {...} catch (exception e) {if (I = 2) Throw e ;}} C ++ builder has not been used for several years. CodeWhen I moved to C ++ builder, it was initially like this: for (INT I = 0; I <3; I ++) {try {...} catch (texception & E) {if (I = 2) Throw & E ;}} then calls the upper-layer function to capture exceptions and print them to logs. The result is always a problem when printing logs, ProgramUnable to continue running. Then I suddenly thought of a low-level error: Throw new texception (e) should be used instead of throw & E; E is a stack variable in C ++ builder, in C #, E is a heap variable. Therefore, e can be directly transferred in C #, and a new one is required in C ++ builder to throw the original E as the constructor.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service