4 ms·
throwing an exception in the constructor comes to mind I don't know C++ and thus don't know all the different ways to break constructors and destructors, but t
by devinj 16y ago
throwing an exception in the constructor comes to mind
I don't know C++ and thus don't know all the different ways to break constructors and destructors, but this particular way will be banned-- exceptions are off-limits.
I kind of think that the worst part of all of this will not be the C++ code that is added to gcc, but the massive bikeshedding that looks to be inevitable at the start.
- stingraycharles 16y agoYes, that would indeed be the case if they compiled with -fno-exceptions, which they just might do indeed, - otherwise, you can still cause exceptions to be thrown without using them yourself (for example, if you're out of memory, 'new Foo ()' causes a std::bad_alloc () exception to be thrown). And yes, I feel for the people in the GCC community that have to lead the team through this process of coming up with an acceptable policy most people agree with. I'm pretty sure it will be a challenging task with lots of egos colliding.
- rwmj 16y agoWhy wouldn't a compiler just abort if it runs out of memory? A compiler seems to be a short running program -- I wouldn't even bother too much freeing up allocated memory.
- scott_s 16y agoPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 19087 scschnei 25 0 412m 333m 5480 R 100 16.6 0:07.62 cc1plus Your C++ compiler would be unusable for some modern C++ programs. You're judging how you expect a compiler to behave based on how you've used them in the past. C++ with heavy template meta-programming (like what I was compiling there) can take an enormous amount of memory and CPU time to finish.