Does anybody know if there's any C99 to C89 translator out there,
either free
or commercial. I searched on Google but couldn't see it so far.
Thanks for any tips.
Napi 23 2450
On 2 Jun 2005 19:07:33 -0700, "napi" <na**@axiomsol.com> wrote: Does anybody know if there's any C99 to C89 translator out there, either free or commercial. I searched on Google but couldn't see it so far. Thanks for any tips.
And what would you expect a translator to do with a variable length
array?
<<Remove the del for email>>
Barry Schwarz wrote: And what would you expect a translator to do with a variable length array?
I don't know.
What does the Comeau C99 compiler do with variable length arrays? http://www.comeaucomputing.com/
napi <na**@axiomsol.com> wrote: Does anybody know if there's any C99 to C89 translator out there, either free or commercial. I searched on Google but couldn't see it so far. Thanks for any tips.
Isn't it easier to either a) just use a C99 compiler or b) restrict yourself
to writing C89 code? It's my experience that this sort of translators often
cause more problems than they fix. The best 'translator' is still a human
being who knows what the code is supposed to do...
- Philip
--
Philip Paeps Please don't email any replies ph****@paeps.cx I follow the newsgroup.
If you plan to leave your mark in the sands of time,
you better wear work shoes.
"napi" <na**@axiomsol.com> writes: Does anybody know if there's any C99 to C89 translator out there, either free or commercial. I searched on Google but couldn't see it so far. Thanks for any tips.
I suspect the most likely way to implement a C99 to C89 "translator"
would be as a C99 compiler that produces C89 as its intermediate
language. The resulting C89 code is not likely to be legible or
maintainable.
On the other hand, a translator that generates *legible* C89 code (and
that makes few or no changes to C99 code that happens to be legal C89
code with the same semantics) might be an interesting thing. It
*might* even be useful.
VLAs could be translated to malloc() calls (and code to crash the
program if malloc() returns NULL). Calls type-generic math functions
could be translated to direct calls to the appropriate function for
the type. The "restrict" keyword could just be ignored. Type long
long would have to be implemented with library calls (or as type long
if long happens to be big enough).
If you insist on translating strictly conforming C99 to strictly
conforming C89, the translation limits are going to be a problem (for
example, 63 rather than rather than 32 levels of nested parentheses in
an expression). Realistically, though, most C89 compilers don't
impose fixed limits on that kind of thing.
And so on.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
On Thu, 02 Jun 2005 20:10:25 -0700, "E. Robert Tisdale"
<E.**************@jpl.nasa.gov> wrote: Barry Schwarz wrote:
And what would you expect a translator to do with a variable length array?
I don't know. What does the Comeau C99 compiler do with variable length arrays?
Is the C99 compiler a translator between C99 and C89? No, it is a
translator between C99 and machine code.
Why did you extract the sentence out of context? Do you have
something to contribute to the original question?
<<Remove the del for email>>
On Fri, 3 Jun 2005 07:45:43 +0200, Spiro Trikaliotis
<ne*********@trikaliotis.net> wrote: Hello,
Barry Schwarz <sc******@deloz.net> schrieb:
And what would you expect a translator to do with a variable length array?
Use malloc() and free() instead?
Which would require the use of a synthetic pointer. But what happens
when the array is the operand of sizeof and & operators? And the new
"type" pointer to variable length array is handled how?
<<Remove the del for email>>
Barry Schwarz wrote: Is the C99 compiler a translator between C99 and C89?
Yes.
See http://www.comeaucomputing.com/
What Is Comeau C/C++ 4.3.3?
Comeau C/C++ is a command line driven C and C++ compiler that generates
platform specific and C compiler specific C as its object code (the
generated C code won't work on another platform, as it is CPU, OS and C
compiler specific, and furthermore, it is not standalone). It then
transparently invokes a particular C compiler that we've specifically
ported it to (again, it won't work with one we haven't ported it to --
such porting must be done by Comeau since particulars must be coded into
the compiler and library itself).
In article <t7********************************@4ax.com>,
Barry Schwarz <sc******@deloz.net> wrote: On 2 Jun 2005 19:07:33 -0700, "napi" <na**@axiomsol.com> wrote:
Does anybody know if there's any C99 to C89 translator out there, either free or commercial. I searched on Google but couldn't see it so far. Thanks for any tips.
And what would you expect a translator to do with a variable length array?
Translate it.
There is perhaps 2 questions on the table here.
One is to translate it to a new source code form.
That is probably not possible.
The other is translatation with runtime library support of
the translator/translated code, hence the RTL and the
generated code conspiring to achieve the desired result.
Neither would probably be readable :)
--
Greg Comeau / Celebrating 20 years of Comeauity
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
In article <d7**********@nntp1.jpl.nasa.gov>,
E. Robert Tisdale <E.**************@jpl.nasa.gov> wrote: Barry Schwarz wrote:
And what would you expect a translator to do with a variable length array?
I don't know. What does the Comeau C99 compiler do with variable length arrays?
Current versions make use of our own routines that allow them
to be declared, and for operations to be performed on them.
We can also re-emit them as VLAs if for some reason the backend
has optimized them in some special way(s).
--
Greg Comeau / Celebrating 20 years of Comeauity
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
In article <sl***************************@fasolt.home.paeps.c x>,
Philip Paeps <ph***********@paeps.cx> wrote: napi <na**@axiomsol.com> wrote: Does anybody know if there's any C99 to C89 translator out there, either free or commercial. I searched on Google but couldn't see it so far. Thanks for any tips. Isn't it easier to either a) just use a C99 compiler
Yes, but a C99 translator can also be one of them.
or b) restrict yourself to writing C89 code?
If he really needs C99 he doesn't need to consider that,
unless some other considerations point in that direction.
It's my experience that this sort of translators often cause more problems than they fix. The best 'translator' is still a human being who knows what the code is supposed to do...
This is a bit confusing statement. For instance, if that's so,
why do you program in C?
Also, indeed there are many poor translators out there,
just like there are many good ones, and just like there are
many poor compilers, as afterall, a compiler is a particular
type of translator.
--
Greg Comeau / Celebrating 20 years of Comeauity
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.org> wrote: "napi" <na**@axiomsol.com> writes: Does anybody know if there's any C99 to C89 translator out there, either free or commercial. I searched on Google but couldn't see it so far. Thanks for any tips. I suspect the most likely way to implement a C99 to C89 "translator" would be as a C99 compiler that produces C89 as its intermediate language. The resulting C89 code is not likely to be legible or maintainable.
Right, which need not be a requirement in all cases if it can be
provided proper support.
On the other hand, a translator that generates *legible* C89 code (and that makes few or no changes to C99 code that happens to be legal C89 code with the same semantics) might be an interesting thing. It *might* even be useful.
Besides that it is probably not possible (tgmath, VLAs, complex, etc
come to mind), on the parts that are that would be interesting indeed.
VLAs could be translated to malloc() calls (and code to crash the program if malloc() returns NULL). Calls type-generic math functions could be translated to direct calls to the appropriate function for the type. The "restrict" keyword could just be ignored. Type long long would have to be implemented with library calls (or as type long if long happens to be big enough).
My above comment was not to negate your above, but in enough
case I suspect that the function calls might be overbearing
districting the readability. Just guessing though.
--
Greg Comeau / Celebrating 20 years of Comeauity
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
In article <5r********************************@4ax.com>,
Barry Schwarz <sc******@deloz.net> wrote: On Thu, 02 Jun 2005 20:10:25 -0700, "E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote:Barry Schwarz wrote: And what would you expect a translator to do with a variable length array?
I don't know. What does the Comeau C99 compiler do with variable length arrays?
Is the C99 compiler a translator between C99 and C89? No, it is a translator between C99 and machine code.
Hopefully it is between C99 and C99! :)
--
Greg Comeau / Celebrating 20 years of Comeauity
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
"E. Robert Tisdale" wrote: Barry Schwarz wrote:
Is the C99 compiler a translator between C99 and C89?
Yes. See
http://www.comeaucomputing.com/
What Is Comeau C/C++ 4.3.3?
Comeau C/C++ is a command line driven C and C++ compiler that generates platform specific and C compiler specific C as its object code (the generated C code won't work on another platform, as it is CPU, OS and C compiler specific, and furthermore, it is not standalone). It then transparently invokes a particular C compiler that we've specifically ported it to (again, it won't work with one we haven't ported it to -- such porting must be done by Comeau since particulars must be coded into the compiler and library itself).
WARNING - our resident Trollsdale is now trying to give the
impression he has something to do with Comeau. AFAIK he does not,
and will not. Comeau is respectable.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Greg Comeau wrote: Barry Schwarz <sc******@deloz.net> wrote: "napi" <na**@axiomsol.com> wrote:
Does anybody know if there's any C99 to C89 translator out there, either free or commercial. I searched on Google but couldn't see it so far. Thanks for any tips.
And what would you expect a translator to do with a variable length array?
Translate it.
There is perhaps 2 questions on the table here. One is to translate it to a new source code form. That is probably not possible.
The other is translatation with runtime library support of the translator/translated code, hence the RTL and the generated code conspiring to achieve the desired result.
Neither would probably be readable :)
As long as you can customize to the non-standard aspects of a
particular compiler, you probably have many possibilities. One is
alloca. Another is to simply malloc and free on function exit.
The point is that it doesn't matter, except to the implementor.
The user has a standard approved means of expressing himself.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
CBFalconer <cb********@yahoo.com> writes:
[As a suggestion for translating VLAs into C89] As long as you can customize to the non-standard aspects of a particular compiler, you probably have many possibilities. One is alloca.
The GCC manual notes that VLAs and alloca have different
semantics:
You can use the function `alloca' to get an effect much like
variable-length arrays. The function `alloca' is available in many
other C implementations (but not in all). On the other hand,
variable-length arrays are more elegant.
There are other differences between these two methods. Space
allocated with `alloca' exists until the containing _function_ returns.
The space for a variable-length array is deallocated as soon as the
array name's scope ends.
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Ben Pfaff wrote: CBFalconer <cb********@yahoo.com> writes:
[As a suggestion for translating VLAs into C89] As long as you can customize to the non-standard aspects of a particular compiler, you probably have many possibilities. One is alloca.
The GCC manual notes that VLAs and alloca have different semantics:
You snipped too much, in particular the following sentence:
"The point is that it doesn't matter, except to the implementor.
The user has a standard approved means of expressing himself."
After all, "mov r1, r2" also has different semantics. :-)
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
In article <42***************@yahoo.com>, cb********@yahoo.com says... "E. Robert Tisdale" wrote: Barry Schwarz wrote:
Is the C99 compiler a translator between C99 and C89?
Yes. See
http://www.comeaucomputing.com/
What Is Comeau C/C++ 4.3.3?
Comeau C/C++ is a command line driven C and C++ compiler that generates platform specific and C compiler specific C as its object code (the generated C code won't work on another platform, as it is CPU, OS and C compiler specific, and furthermore, it is not standalone). It then transparently invokes a particular C compiler that we've specifically ported it to (again, it won't work with one we haven't ported it to -- such porting must be done by Comeau since particulars must be coded into the compiler and library itself).
WARNING - our resident Trollsdale is now trying to give the impression he has something to do with Comeau. AFAIK he does not, and will not. Comeau is respectable.
I see nothing above to indicate ERT is trying to claim he has anything
to do with it. On what do you base this claim?
--
Randy Howard (2reply remove FOOBAR)
"I don't really care about being right you know,
I just care about success." --Steve Jobs
CBFalconer <cb********@yahoo.com> writes: "E. Robert Tisdale" wrote: Barry Schwarz wrote:
Is the C99 compiler a translator between C99 and C89?
Yes. See
http://www.comeaucomputing.com/
What Is Comeau C/C++ 4.3.3?
Comeau C/C++ is a command line driven C and C++ compiler that generates platform specific and C compiler specific C as its object code (the generated C code won't work on another platform, as it is CPU, OS and C compiler specific, and furthermore, it is not standalone). It then transparently invokes a particular C compiler that we've specifically ported it to (again, it won't work with one we haven't ported it to -- such porting must be done by Comeau since particulars must be coded into the compiler and library itself).
WARNING - our resident Trollsdale is now trying to give the impression he has something to do with Comeau. AFAIK he does not, and will not. Comeau is respectable.
I didn't get that impression when I read ERT's article, so I suspect
it wasn't deliberate. But yes, he should have indicated more clearly
that he was quoting from the web page, not speaking on behalf of
Comeau.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Randy Howard wrote: cb********@yahoo.com says... "E. Robert Tisdale" wrote: Barry Schwarz wrote:
Is the C99 compiler a translator between C99 and C89?
Yes. See
http://www.comeaucomputing.com/
What Is Comeau C/C++ 4.3.3?
Comeau C/C++ is a command line driven C and C++ compiler that generates platform specific and C compiler specific C as its object code (the generated C code won't work on another platform, as it is CPU, OS and C compiler specific, and furthermore, it is not standalone). It then transparently invokes a particular C compiler that we've specifically ported it to (again, it won't
^^^^^ work with one we haven't ported it to -- such porting must be
^^^^^^^^^^ done by Comeau since particulars must be coded into the compiler and library itself).
WARNING - our resident Trollsdale is now trying to give the impression he has something to do with Comeau. AFAIK he does not, and will not. Comeau is respectable.
I see nothing above to indicate ERT is trying to claim he has anything to do with it. On what do you base this claim?
I said "give the impression". See underlining above. Also the
overall tone.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
In article <42***************@yahoo.com>, cb********@yahoo.com says... Randy Howard wrote: http://www.comeaucomputing.com/
What Is Comeau C/C++ 4.3.3?
Comeau C/C++ is a command line driven C and C++ compiler that generates platform specific and C compiler specific C as its object code (the generated C code won't work on another platform, as it is CPU, OS and C compiler specific, and furthermore, it is not standalone). It then transparently invokes a particular C compiler that we've specifically ported it to (again, it won't ^^^^^ work with one we haven't ported it to -- such porting must be ^^^^^^^^^^ done by Comeau since particulars must be coded into the compiler and library itself).
WARNING - our resident Trollsdale is now trying to give the impression he has something to do with Comeau. AFAIK he does not, and will not. Comeau is respectable.
I see nothing above to indicate ERT is trying to claim he has anything to do with it. On what do you base this claim?
I said "give the impression". See underlining above. Also the overall tone.
It was pretty obviously a straight quote off of the website. *shrug*
--
Randy Howard (2reply remove FOOBAR)
"I don't really care about being right you know,
I just care about success." --Steve Jobs
CBFalconer <cb********@yahoo.com> writes: Ben Pfaff wrote: CBFalconer <cb********@yahoo.com> writes:
[As a suggestion for translating VLAs into C89] As long as you can customize to the non-standard aspects of a particular compiler, you probably have many possibilities. One is alloca.
The GCC manual notes that VLAs and alloca have different semantics:
You snipped too much, in particular the following sentence:
"The point is that it doesn't matter, except to the implementor. The user has a standard approved means of expressing himself."
My point is that alloca() is not always a good way to implement a
VLA.
--
"To get the best out of this book, I strongly recommend that you read it."
--Richard Heathfield This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michiel |
last post by:
Hi
Does anyone know if there exists some sort of php to java translator. I
dont expect it to produce running code, as I am willing to edit the
result by hand. So any sort of beta version would...
|
by: Rene Schneider |
last post by:
Has anybody ever experimented with something like an ABAP to PHP or
JSP translator?
Can you think of any elements missing for this purpose from PHP/JSP
compared to ABAP?
Do you think such a...
|
by: Dan Jacobson |
last post by:
An old dog can't learn new tricks, so where's the a2py awk to python
translator? Perl has a2p. E.g. today I wonder how to do '{print
$1}', well with a2p I know how to do it in perl, but with...
|
by: Bruce Dickey |
last post by:
Hi,
I'm moving some functionality from the server to the local PC and need to
translate some PHP scripts to Python. They just do file manipulation.
Anybody know of a PHP to Python translator?...
|
by: frederik |
last post by:
Hi
Have someone already tested with the .Net Translator component.
I downloaded the component from www.dotnettranslator.com to test and it
seems very easy to use.
My problem was that...
|
by: frederik |
last post by:
Hi
Have someone already tested with the .Net Translator component.
I downloaded the component from www.dotnettranslator.com to test and it
seems very easy to use.
My problem was that...
|
by: Bob Nelson |
last post by:
My interest in this new topic was piqued by santosh's recent posting
concerning the subject of ``diagnostic message'' here in clc.
After reading the C99 standard (``n1256.pdf''), I am unclear if...
|
by: forums_mp |
last post by:
Facing a design problem here and I'm not sure how to solve this. The
system consists of bi-directional communication between a subject
communicating with two (at least for now ) listeners. ...
|
by: paulrajj |
last post by:
hi everyone,
i want to translate my webpage contents from english language to dutch language. is there any language translator class or package available in php? i have searched a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |