cpp:exception
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
cpp:exception [2018/05/20 15:02] – [Κλείσιμο ανοιχτών resources όταν συμβεί ένα exception] gthanos | cpp:exception [2018/05/21 02:00] – [Ένα 2ο παράδειγμα] gthanos | ||
---|---|---|---|
Line 513: | Line 513: | ||
Το ενδεικτικό αρχείο εισόδου είναι το παρακάτω: | Το ενδεικτικό αρχείο εισόδου είναι το παρακάτω: | ||
- | <code 3x2.ppm> | + | < |
P3 | P3 | ||
3 -2 255 | 3 -2 255 | ||
Line 537: | Line 537: | ||
Το //exception std:: | Το //exception std:: | ||
- | < | + | <code> |
+ | $> ./ | ||
+ | std:: | ||
+ | terminate called after throwing an instance of ' | ||
+ | what(): | ||
+ | Aborted (core dumped) | ||
+ | </ | ||
+ | |||
+ | Ο λόγος που συμβαίνει το παραπάνω είναι ότι το όταν το //catch block// παράγει και πάλι το // | ||
+ | |||
+ | <code cpp> | ||
+ | catch(std:: | ||
+ | cerr << " | ||
+ | in.close(); | ||
+ | throw ex; // rethrows the same exception object | ||
+ | } | ||
+ | </ | ||
===== Δήλωση των εξαιρέσεων που παράγουν οι συναρτήσεις (exception specifiers) ===== | ===== Δήλωση των εξαιρέσεων που παράγουν οι συναρτήσεις (exception specifiers) ===== | ||
cpp/exception.txt · Last modified: 2023/05/15 14:01 by gthanos