Liste des Groupes | Revenir à cl c |
The error from opendir(..):With C++ that's all encapsulated in filesystem_error which is derived
EACCES Permission denied.
EBADF fd is not a valid file descriptor opened for reading.
EMFILE The per-process limit on the number of open file descriptors has
been reached.
ENFILE The system-wide limit on the total number of open files has been
reached.
ENOENT Directory does not exist, or name is an empty string.
ENOMEM Insufficient memory to complete the operation.
ENOTDIR name is not a directory.
...
I think your 'less work' was from simplication or idealization, lots areNo, show me your C code to iterate through a directory and I show you
simplified and idealized.
If you can handle errors that way, C can also do it in much simpler way.Absolutely not.
The basic problem of throwing error is losing error context, it is similarThe context doesn't matter. A bad_alloc doesn't need context, a
to set a global errno (or object) and cause the program to stack unwind.
C++ has many artificial fancy things and encourages such programming style.C is bad, because you've to do simple things over and over with multiple
Good or bad? Both, but I would say mostly bad.
Les messages affichés proviennent d'usenet.