Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Makes it sense to get a copy of the ANSI standard documents?
As already noted a few months ago I'm working on a language, that
is intended to be compiled into C as an intermediary.

ATM I'm working with the latest publically avaliable draft of C99
avaliable from open-std.org. However I was considering to obtain
a copy of the real thing, but I wonder if it worth it. Mainly
I'm interested in _generating_ standard conforming code. Is it
worth it? Also I'd like to know, where to get a copy of the old
C90 standard, I can't find it on the ANSI website.

And then there's the question which version to target. C90 would
be the most portable for sure, OTOH any program compiled with my
compiler will have been written after 2006 so I can be sure to
have a final C stage that knows at least some C99. Some C99
features would be nice. So what is really safe to be used
_today_?

Wolfgang Draxinger
--
E-Mail address works, Jabber: hexarith@jabber.org, ICQ: 134682867


Report this thread to moderator Post Follow-up to this message
Old Post
Wolfgang Draxinger
04-02-08 12:00 AM


Re: Makes it sense to get a copy of the ANSI standard documents?
On Apr 1, 5:14=A0pm, Wolfgang Draxinger <wdraxin...@darkstargames.de>
wrote:
> As already noted a few months ago I'm working on a language, that
> is intended to be compiled into C as an intermediary.
>
> ATM I'm working with the latest publically avaliable draft of C99
> avaliable from open-std.org. However I was considering to obtain
> a copy of the real thing, but I wonder if it worth it. Mainly
> I'm interested in _generating_ standard conforming code. Is it
> worth it? Also I'd like to know, where to get a copy of the old
> C90 standard, I can't find it on the ANSI website.
>
> And then there's the question which version to target. C90 would
> be the most portable for sure, OTOH any program compiled with my
> compiler will have been written after 2006 so I can be sure to
> have a final C stage that knows at least some C99. Some C99
> features would be nice. So what is really safe to be used
> _today_?


It certainly can't hurt to have a copy of the standard, at least it
gives you a baseline which is fairly well supported.  See:

http://clc-wiki.net/wiki/The_C_Standard

For a list of ways to get the C89/90 standards.  The commonly used
draft is pretty darn close to the final standard, and is free (unlike
the real dead tree version of c89).

While the real C99 standard is available for a reasonable price, and
even in electronic form, unfortunately c99 is very poorly supported in
the world.

While probably heresy in this group, targeting C++ instead of C as an
intermediate language has become very common, the ability to define
types and overloaded operators is very nice in this application.  And C
++ is infinitely better supported than C99 (although not C89).

Report this thread to moderator Post Follow-up to this message
Old Post
robertwessel2@yahoo.com
04-02-08 12:00 AM


Re: Makes it sense to get a copy of the ANSI standard documents?
robertwessel2@yahoo.com wrote:
>
> While probably heresy in this group, targeting C++ instead of C as an
> intermediate language has become very common, the ability to define
> types and overloaded operators is very nice in this application.  And C
> ++ is infinitely better supported than C99 (although not C89).

This is pure nonsense.

Nobody is going to WRITE that code nor it is going to read it!
You can make your code call
add128(a,b)

with the SAME effort that you write
a+b

Operator overloading is useful for PEOPLE writing code.

When a machine writes the code nobody would care, and you
would have to cope with C++.

Did you know that code trhat compiled without a hitch in
IBM C++ xlc 8.0 will no longer compile in IBM xlc 9.0?

And code that compiled without any problems in gcc 3.4
will no longer compile in gcc 4.0?

C++ is a language that *maybe* is useful for people
writing code. For an automatic generator is sheer nonsense.

The more lower level you go, the better.


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32

Report this thread to moderator Post Follow-up to this message
Old Post
jacob navia
04-02-08 12:00 AM


Re: Makes it sense to get a copy of the ANSI standard documents?
Wolfgang Draxinger wrote:
> As already noted a few months ago I'm working on a language, that
> is intended to be compiled into C as an intermediary.
>
> ATM I'm working with the latest publically avaliable draft of C99
> avaliable from open-std.org. However I was considering to obtain
> a copy of the real thing, but I wonder if it worth it. Mainly
> I'm interested in _generating_ standard conforming code. Is it
> worth it? Also I'd like to know, where to get a copy of the old
> C90 standard, I can't find it on the ANSI website.


I think what you need is C95, not C90. C95 is C90 with some bugs fixed +
3 new headers, <wchar.h>, <iso646.h>, <wctype.h>.


If you can't find a copy of C95/C90, you can buy the book "The C
Programming Language" 2nd Edition by Brian Kernighan, Dennis Ritchie
(the creator of C) which towards the end has an "Appendix A: Reference
manual".

The first part of its introduction is the following:

"A1. Introduction

This manual describes the C language specified by the draft
submitted to ANSI on 31 October 1988, for approval as "American National
Standard for Information Systems-Programming Language C, X3.159-1989".
The manual is an interpretation of the proposed standard, not the
Standard itself, although care has been taken to make it a reliable
guide to the language".

Report this thread to moderator Post Follow-up to this message
Old Post
Ioannis Vranos
04-02-08 12:00 AM


Re: Makes it sense to get a copy of the ANSI standard documents?
Ioannis Vranos <ivranos@nospam.no.spamfreemail.gr> writes:

> Wolfgang Draxinger wrote: 
>
>
> I think what you need is C95, not C90. C95 is C90 with some bugs fixed +
> 3 new headers, <wchar.h>, <iso646.h>, <wctype.h>.
>
>
> If you can't find a copy of C95/C90, you can buy the book "The C
> Programming Language" 2nd Edition by Brian Kernighan, Dennis Ritchie
> (the creator of C) which towards the end has an "Appendix A: Reference
> manual".
>
> The first part of its introduction is the following:
>
> "A1. Introduction
>
>     This manual describes the C language specified by the draft
> submitted to ANSI on 31 October 1988, for approval as "American National
> Standard for Information Systems-Programming Language C, X3.159-1989".
> The manual is an interpretation of the proposed standard, not the
> Standard itself, although care has been taken to make it a reliable
> guide to the language".

With all due respect, you do not even know about sequence points and
undefined behaviour. Do you really think you are qualified to tell a
compiler writer what versions of the standard he should be using?

K&R 2 is not a standard in the true "standard" sense.



Report this thread to moderator Post Follow-up to this message
Old Post
Richard
04-02-08 12:00 AM


Re: Makes it sense to get a copy of the ANSI standard documents?
Richard wrote:
>
> With all due respect, you do not even know about sequence points and
> undefined behaviour.


I know about undefined behaviour. I do not know about sequence points,
because all the books I have read regarding C and C++ didn't mention
them (I am in the application programming area, not compiler creation).
Of course, I'll check the standards to find out what sequence points are.


> Do you really think you are qualified to tell a
> compiler writer what versions of the standard he should be using?

I think I have a down to earth knowledge about the various C and C++
standards and their differences.

C95 is essentially the C standard that the most popular C compilers
support (and is the "C subset" of C++98/C++03).


Given that C95, is C90 fixed and improved, and not a major evolution
like C99, I think if one is to by a C standard that is not C99, he
should pick C95.

Report this thread to moderator Post Follow-up to this message
Old Post
Ioannis Vranos
04-02-08 12:00 AM


Re: Makes it sense to get a copy of the ANSI standard documents?
Wolfgang Draxinger wrote:

> As already noted a few months ago I'm working on a language, that
> is intended to be compiled into C as an intermediary.
>
> ATM I'm working with the latest publically avaliable draft of C99
> avaliable from open-std.org. However I was considering to obtain
> a copy of the real thing, but I wonder if it worth it. Mainly
> I'm interested in generating standard conforming code. Is it
> worth it? Also I'd like to know, where to get a copy of the old
> C90 standard, I can't find it on the ANSI website.

Here a draft of the C90 standard:
http://flash-gordon.me.uk/ansi.c.txt

You can purchase the current standard (INCITS/ISO/IEC 9899-1999
(R2005)) for $30, but the former standard is hard to come by for a
reasonable price.

> And then there's the question which version to target. C90 would
> be the most portable for sure, OTOH any program compiled with my
> compiler will have been written after 2006 so I can be sure to
> have a final C stage that knows at least some C99. Some C99
> features would be nice. So what is really safe to be used
> _today_?

If you use a fairly ubiquitous compiler like GCC, then you could safely
use the C99 features available in GCC.

HTH

--
Posted via a free Usenet account from http://www.teranews.com


Report this thread to moderator Post Follow-up to this message
Old Post
richard kenny twink
04-02-08 01:00 PM


Re: Makes it sense to get a copy of the ANSI standard documents?
"jacob navia" <jacob@nospam.com> wrote in message
news:fsudpu$5o6$1@aioe.org...
> robertwessel2@yahoo.com wrote: 
>
> This is pure nonsense.
>
> Nobody is going to WRITE that code nor it is going to read it!
> You can make your code call
> add128(a,b)
>
> with the SAME effort that you write
> a+b

I agree almost entirely with this.

But, the code generator has to /know/ that add128 is needed and not add64
etc. So if no proper type analysis has been done, and the language has types
only fully supported in C++, then maybe a C++ target can start to make
sense.

It sounds like the OP has more sensibly chosen C as a target however.

> The more lower level you go, the better.

Well, not too low a level. A C intermediate representation seems popular,
although generating actual /source/ (and being bothered about syntax and
name spaces and such matters that are irrelevant to the original language)
has it's own problems.

--
Bart




Report this thread to moderator Post Follow-up to this message
Old Post
Bartc
04-02-08 01:00 PM


Re: Makes it sense to get a copy of the ANSI standard documents?
On Apr 1, 5:43=A0pm, jacob navia <ja...@nospam.com> wrote:
> robertwess...@yahoo.com wrote:
> 
C 
>
> This is pure nonsense.
>
> Nobody is going to WRITE that code nor it is going to read it!
> You can make your code call
> =A0 =A0 =A0 =A0 add128(a,b)
>
> with the SAME effort that you write
> =A0 =A0 =A0 =A0 a+b
>
> Operator overloading is useful for PEOPLE writing code.
>
> When a machine writes the code nobody would care, and you
> would have to cope with C++.


We'll have to disagree on this, but for just one example, your
approach requires the front end compiler to explicitly manage
temporaries when evaluating expressions, which is work that can be put
off to the C++ back end.  The length of a particular function
invocation is not much of an issue for q code generator; but using
higher level constructs in the back end can often allow simpler code
to be emitted.  Now you may *want* to do that in some cases to
maintain full control over how expression is evaluated, but C++ gives
you the choice.


> Did you know that code trhat compiled without a hitch in
> IBM C++ xlc 8.0 will no longer compile in IBM xlc 9.0?
>
> And code that compiled without any problems in gcc 3.4
> will no longer compile in gcc 4.0?


And there have never been release dependent glitches in C compilers?

That being said, using C as a back end will likely give you better
portability.


> C++ is a language that *maybe* is useful for people
> writing code. For an automatic generator is sheer nonsense.
>
> The more lower level you go, the better.


Sometimes yes, sometimes no.

Report this thread to moderator Post Follow-up to this message
Old Post
robertwessel2@yahoo.com
04-02-08 01:00 PM


Re: Makes it sense to get a copy of the ANSI standard documents?
jacob navia wrote:
> C++ is a language that *maybe* is useful for people
> writing code. For an automatic generator is sheer nonsense.
>
> The more lower level you go, the better.


Just for informative purposes, the "assembly language" of CLI
(.NET/Mono) CIL (sometimes mentioned ILASM), is object oriented.


MS has a book about "ILASM". Check Amazon.

Report this thread to moderator Post Follow-up to this message
Old Post
Ioannis Vranos
04-02-08 01:00 PM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

C archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:53 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.