J
JohnQ
Alf P. Steinbach said:* JohnQ -> Greg Comeau:
Yes. If you don't have the Dragon book, get it.
I don't need it. I'm not building a compiler.
John
Alf P. Steinbach said:* JohnQ -> Greg Comeau:
Yes. If you don't have the Dragon book, get it.
How can you consider "the same thing" having to have 2 tools
installed rather than just one to get the same result?
But Comeau feed into VC++ (or g++), yes? It still seems like
you have all the issues with the platform compiler plus any
issues with the front end.
Though using different compilers does help check out your code better.
You'll probably write less portable code and have more bugs within the
safety of one compiler than if you were to build with many.
But it's still apples and oranges if you ask me because Comeau
is not a "from source to executable" product. It seems like a
special-purpose product to use when you want to code in C++
but one or more of your target platforms doesn't have a C++
compiler. Yes?
I don't think that is correct. I think it translates to
platform-compiler-specific C.
(Which compilers it uses on which platforms, I
don't know. VC++ on Windows?)
I don't see how the effects of using multiple compilers/tools
wouldn't be additive as far as the potential issues go.
It's
just that Comeau abstracts one away from one set of the
issues. But who's to say they're better at it than you are?
It appears to me that you'd have to be targeting a lot of
"weird" hardware where Comeau is and other C++ compilers
aren't, in or to be using the product. If all your platforms
had a C++ compiler or g++, you'd probably use those/that.
Having TWO intermediate representations doesn't seem good.
Also, there's 2 vendor dependencies: Comeau front end and the
platform compiler. Seems painful: more vendors, more pain. Am
I missing some info?
Would you agree that if I was (just) developing GUI programs
with wxWindows on Windows and on FreeBSD/X I would not want to
use Comeau?
JohnQ said:If "compiling" means going to intermediate form though, what is "going
from source to executable" then? Just a different form of compiling, as
in "compile to exe", "compile to assembly"? Is the terminology really
ambiguous or are there definitions?
You're saying that it's "compiling" rather than just "translating" because
you are going to an intermediate form in between the C++ source and the
generated C source. I think Bjarne S. called cfront a compiler for that
reason too, noting that it had symbol tables etc. so that made it more than
a preprocessor. It really shouldn't be subjective, there should be industry
definitions that are unambigous. Are there?
Example: A platform compiler that goes from C++ source to intermediate form
to assembly. Is that "compiling"? Maybe it is because the resulting form is
native (x86 assembly, for example) to the hardware. Maybe it's not though.
Maybe it's just "translation to assembly". Maybe the assembler is the real
"compiler" because it produces a target in machine code.
I dunno. Certainly in the common usage, I think of going from source code to
machine code as "compiling". If a product gets me half way there, then to
me, it's a "front end" of some sort. So, more than a preprocessor, but less
than a compiler. A "translator"?
Now that I think about it more though, maybe going from source code to
intermediate form is "compiling", as in "compile to intermediate form" (!).
I know that the C++ defines the phases of translation, so maybe I'm just not
boned up on those definitions.
If "compiling" means going to intermediate form though, what is "going from
source to executable" then? Just a different form of compiling, as in
"compile to exe", "compile to assembly"? Is the terminology really ambiguous
or are there definitions?
...
I don't need it. I'm not building a compiler.
Greg Comeau said:Ok, but you asked about some of this stuff, and the "Dragon Book"
is normally considered a solid reference on some of this stuff.
Thomas J. Gritzan said:A compiler goes from a source language to a target language, that can be
assembly, machine code, C or whatever.
<http://en.wikipedia.org/wiki/Compiler>:
"A compiler is a computer program (or set of programs) that translates
text
written in a computer language (the source language) into another computer
language (the target language). The original sequence is usually called
the
source code and the output called object code. Commonly the output has a
form suitable for processing by other programs (e.g., a linker), but it
may
be a human-readable text file."
Greg Comeau said:Most things have some subjective level to them. But most definitions
usually come to similar conclusion. Anyway, I'm not just saying it's
compiling because it is going to an intermediate form. I think it's
worth point out that error checking, syntax checking, semantic analysis,
etc are all done. The difference is that the code generation phase
emits a different object code.
One way to look at it is as a special compiler. Just like a compiler
is a special translator. And so on.
Maybe front-end compiler would work for what I believe you're seeking.''
Aha!
Right, actually many of the standards (certainly C and C++) punt on
terms like compiling, linking, etc. and stick instead to issues
such as phases, and semantics.
If I understand your question, yes, I would say they are different
forms and different stages of compiling.
How can you consider "the same thing" having to have 2 tools
installed rather than just one to get the same result?
But Comeau feed into VC++ (or g++), yes? It still seems like
you have all the issues with the platform compiler plus any
issues with the front end.
Though using different compilers does help check out your code better.
You'll probably write less portable code and have more bugs within the
safety of one compiler than if you were to build with many.
But it's still apples and oranges if you ask me because Comeau
is not a "from source to executable" product. It seems like a
special-purpose product to use when you want to code in C++
but one or more of your target platforms doesn't have a C++
compiler. Yes?
I don't think that is correct. I think it translates to
platform-compiler-specific C.
(Which compilers it uses on which platforms, I
don't know. VC++ on Windows?)
I don't see how the effects of using multiple compilers/tools
wouldn't be additive as far as the potential issues go.
It's
just that Comeau abstracts one away from one set of the
issues. But who's to say they're better at it than you are?
It appears to me that you'd have to be targeting a lot of
"weird" hardware where Comeau is and other C++ compilers
aren't, in or to be using the product. If all your platforms
had a C++ compiler or g++, you'd probably use those/that.
Having TWO intermediate representations doesn't seem good.
Also, there's 2 vendor dependencies: Comeau front end and the
platform compiler. Seems painful: more vendors, more pain. Am
I missing some info?
Would you agree that if I was (just) developing GUI programs
with wxWindows on Windows and on FreeBSD/X I would not want to
use Comeau?
JohnQ said:"That too, but what I was really thinking of is the idea of using
Comeau for all of the platforms. That way, you have the same
C++ everywhere. (In the Unix world, a number of places use g++
systematically just for this very reason. There are a number of
subtle differences between xlC and Sun CC, but g++ is the same
on both AIX and Solaris.)"
jacob navia said:JohnQ wrote:
JohnQ said:"JohnQ quoted JK" you mean.
I knew someone was going to say that. And I already knew what I was going to
say in return: I'd rather know what the C++ standard has to say about those
things. I've heard "translation phases" in here before, but I don't remember
or know if they actually put names on all of them. As in: translation phase
1, preprocessing.
John
I knew someone was going to say that. And I already knew what
I was going to say in return: I'd rather know what the C++
standard has to say about those things. I've heard
"translation phases" in here before, but I don't remember or
know if they actually put names on all of them. As in:
translation phase 1, preprocessing.
I knew someone was going to say that. And I already knew what I was going to
say in return: I'd rather know what the C++ standard has to say about those
things. I've heard "translation phases" in here before, but I don't remember
or know if they actually put names on all of them. As in: translation phase
1, preprocessing.
It would seem then that just saying "compiling" is indeed ambiguous if one
wants to know what's really going on behind the scenes...
like "compiling to proprietary intermediate form" is in order.
So, you're telling me that "compiling" = error checking + syntax checking +
semantic analysis + etc? I'd accept that. Then everything that happens after
that is translation. Translate to assembly or C or machine code or whatever.
Yes?
I knew someone was going to say that. And I already knew what
I was going to say in return: I'd rather know what the C++
standard has to say about those things. I've heard
"translation phases" in here before, but I don't remember or
know if they actually put names on all of them. As in:
translation phase 1, preprocessing.
Greg Comeau said:The closest it really comes to is mentioning preprocessing. The rest is
really dealing with the semantics of things, revolving names not
linking per se, syntax analysis but not how to scan or lex per se
(I'm not saying that right, but hopefully the point comes though),
and so on. This way, it leaves translation open to other options beyond
traditional "compiling".
"By not counting the number of tools? I must have about twenty
or thirty different tools installed on my Windows machine; if I
were to use it for actual development, I'd need quite a few
more. If I count each package as a "tool" on my Linux box, I'm
in the hundreds. One more or less doesn't mean that much."
That's a facetious argument. The window is that of compiling source code.
Pretend it's the last compile before packaging and deployment and not
everything from concept to purchasing shrink-wrapped sofware in a retail
store. But it's not worth talking about. If you think that exotic means of
compiling should be considered everywhere, all the time, so be it.
Me: Using 2 compilers in a chain is for very specialized, very
non-mainstream development scenarios.
You: No it's not.
"It feeds C into VC++ or g++. Very old-fashioned C. C's been
around for a long time, is very stable and relatively simple.
I'd be very surprised if there were any serious bugs in the C
compiler of gcc or VC++. Where as with C++..."
I thought it was very compiler-specific C.
"That too, but what I was really thinking of is the idea of using
Comeau for all of the platforms. That way, you have the same
C++ everywhere. (In the Unix world, a number of places use g++
systematically just for this very reason. There are a number of
subtle differences between xlC and Sun CC, but g++ is the same
on both AIX and Solaris.)"
It just means that you are jobbing out the difference resolution to Comeau
instead of doing it yourself.
Instead of dealing with differences in C++
implementations, you're letting Comeau deal with differences in C
implementations. Of course, doing it in C is an alternative also.
"It's definitly not a "from source to executable" product.
Neither is g++, for that matter, at least not under Solaris
(where it uses the Sun linker). And that's certainly a
consideration."
Comeau will get the code to something platform-specific but not
hardware-specific. That's why I consider it a "front end". Which begs the
question: "Why doesn't Comeau put a back end on it for each platform and
sell a "real" compiler?
"But as I said above, you typically need other
tools anyway, like a data base. And you probably won't find the
same "from source to executable" product available on all of
your target platforms. Using the same compiler front-end on all
of your platforms frees you from having to worry about
variations in the language the compiler understands, or in its
interpretation of the standard."
Again, you're just trading C++ difference management for someone else doing
C difference management. Increasingly, that makes less and less sense
because compilers have evolved and will continue to do so. (Of course, what
I'd prefer is a "devolved" C++ to solve the problem instead of
masking/bandaiding it).
"And IMHO, that is the main argument for using Comeau,
professionally. If you're only concerned about one system, and
portability is not a concern, then the obvious solution is the
"native" compiler: VC++ under Windows, g++ under Linux, Sun CC
under Solaris, etc."
Nah, it's bad all around (note JohnQ jumping out of the hot oil): C++ should
be implementable. If it is so bad that one cannot trust that code can be
written to be compiled on any compiler, something else is VERY VERY wrong.
So no, making one C++ implementation "THE C++" is not a good answer. You may
want to note that I frequently suggest here that C++ is too complex,
over-kill etc., that a simpler language to implement is compelling, and that
your "stand" in this thread supports the basis for my quest quite well.
"(That's professionally, of course. I know more than a few
people who use Comeau on the side, because they want to
experiment with standard C++, and be sure that what they are
learning corresponds to the standard---with the hope, of course,
that as time goes on, more compilers will conform.)"
1. I think the importance of standard conformance is over-blown relative to
all development issues.
2. I understand why people "close to" a language would think that way or try
to make it that way.
3. <something about C++'s complexity leading to it's obsolescence>
"That's true. But it's still a basic "format" that can be used
on just about every platform."
I don't think so. That's why I said 'platform-specific' C.
It just all seems
really silly: translate to another HLL in a form that won't compile
everywhere without massaging it. Well, that was the same thing at the
get go with the C++ code!
"I think you can choose, at least to some degree. (Under Linux,
it's gcc. And I don't think you have a choice there.)"
"If you use Comeau, you get the potential issues of Comeau C++,
plus the potential issues of the native C compiler. If you use
the native C++ compiler, you get its potential issues.
Generally speaking, the first set is smaller than the second, at
least with regards to bugs and language issues."
I think a better approach is to know what the issues are and then code
around them.
To wait for the next version of the platform-specific compiler
or the next C++ standard when "things are ready for prime time".
"They're not just abstracting away one set of issues. You're
replacing the issues of your native C++ compiler with those of
Comeau plus the native C compiler. Typically, the native C
compiler has almost no problems, so it's Comeau C++ vs. the
native C++. And the people behind the Comeau compiler (which is
a port of the EDG front-end) are better than those behind just
about any other C++ compiler. Much better, usually."
Comeau is a very specialized tool, not in the same category as mainstream
compilers, IMO.
The applicability of the Comeau product is directly related
to the problem with the C++ language. I'd rather see the language fixed,
replaced or a new language. "Design for producibility" is a good engineering
concept for language designers also. Back to the drawing board?
"If they all had a compatible C++ compiler, yes. I certainly
don't look for such a tool for C. But they don't. C++
compilers still vary greatly in how much of the standard they
implement, and how they interpret it."
Like I said, I can see where you would be more apt to worry about that than
most. In the short term, I think the appropriate action is to talk to the
compiler vendors when something is lacking. A language that can only be
implemented by very few companies, or just by companies for that matter, is
"not ready for prime time" or lacks "goodness"/quality.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.