AFAIK gcc is not the best designed program in the world (I just compiled it once, and to me it seemed to be a huge bunch of patches over patches). At the same time I know C++ enough to consider it extremely error-prone, expecially if not managed correctly! Put together the two things and ...maybe it's time to have a look to some other compiler. What about TCC? :P
...or LLVM :-P http://en.wikipedia.org/wiki/Low_Level_Virtual_Machine "The Low Level Virtual Machine (LLVM) is a compiler infrastructure, written in C++ , which is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming languages. "
GCC starts move towards implementation in C++
21–30 of 37 posts
Re: GCC starts move towards implementation in C++
#22Yes, they just allowed it. They're not going to rewrite gcc in C++. But still, why, oh why? Eventhough C++ allows, in some cases, the possibility to use easier syntax for certain constructs, it's not particularly more expressive language than C. I don't know gcc codebase but if they decided to actually reimplement something in C++, it would take a lot of time just to make it comparable to the current C implementation…
Re: GCC starts move towards implementation in C++
#23Re: GCC starts move towards implementation in C++
#24Earlier quoted context omitted.
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.
Yes, 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 acc…
Re: GCC starts move towards implementation in C++
#25Earlier quoted context omitted.
Yes, 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 acc…
Why 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.
PID 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.Re: GCC starts move towards implementation in C++
#26When I read this stuff, like what to ban, what to allow and so forth, it's impossible for me to avoid thinking that actually C++, Objective-C, and D, are not enough. We are still in a world where a "better C" is needed as the available choices are not good enough.
Re: GCC starts move towards implementation in C++
#27So we have another two months of bike shedding right here.
Re: GCC starts move towards implementation in C++
#28When I read this stuff, like what to ban, what to allow and so forth, it's impossible for me to avoid thinking that actually C++, Objective-C, and D, are not enough. We are still in a world where a "better C" is needed as the available choices are not good enough.
Out of curiosity, how did you lump Objective-C and D into this. I haven't heard of people banning the use features of Objective-C and D like they do with C++. //well, except where the platform doesn't support the feature (e.g. iPhone::Garbage Collection).
I think Objective-C is taken alive by the fact that Apple is pushing it forward, IMHO this is already telling enough about it. A few things are nice but it's too verbose, the syntax is not nice, some semantic is tricky (memory management is confusing for newcomers), and I feel in it a strange mix of high level features with other things that are too low level or not well conceived (like @synthesize).
D has other problems (like two different flavors and other stuff related to the fact it's pretty recent) but I think it does not qualify as the "better C" that can really be accepted in short time, as the difference with C is too strong and it's not a strict superset of C.
What I think it's needed is a C with classes without fancy features and with a solid standard library that makes good use of the new OOP stuff. The layer that's enough to avoid to write structures and function pointers to fake objects, just that tiny layer, but done right. Not claiming this is easy at all, but probably there are very little people interested in solving this problem right now.
Re: GCC starts move towards implementation in C++
#29When I read this stuff, like what to ban, what to allow and so forth, it's impossible for me to avoid thinking that actually C++, Objective-C, and D, are not enough. We are still in a world where a "better C" is needed as the available choices are not good enough.
I think Go might become a viable alternative to C for systems programming.
Re: GCC starts move towards implementation in C++
#30Very interesting read about the problems of C++.