public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <jsm@polyomino.org.uk>
To: Scott Robert Ladd <coyote@coyotegulch.com>
Cc: Ziemowit Laski <zlaski@apple.com>, gcc-patches@gcc.gnu.org
Subject: Re: New C parser [patch]
Date: Tue, 26 Oct 2004 00:37:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0410252343480.11937@digraph.polyomino.org.uk> (raw)
In-Reply-To: <417D8F67.5070105@coyotegulch.com>

On Mon, 25 Oct 2004, Scott Robert Ladd wrote:

> Also, C and C++ are heading down different and incompatible paths. It will be
> increasingly difficult to manage the subtle-but-important differences in a
> single front end if the two languages continue to diverge.

I would add that the calls a few years ago for merging the languages came 
generally from the C++ side; it has mainly been people with a largely C++ 
background calling for a merge of the languages, and the same may apply to 
merging front ends; in both cases the costs fall disproportionately on C.

(It has been said that there are three languages, C, C++ and C/C++, the 
last being that referred to by those who don't understand the difference.)

Starting 25 years ago, heading for a single language would have been a 
better direction.  However, we don't get to go back to 25 years ago and 
change the decisions that were made.  We have two languages evolving on 
diverging tracks; sometimes ideas and features come from one to the other, 
but because of the different histories may not be quite compatible.  

Where there are similarities in appearance and a subset of code works in 
both languages, the underlying concepts in the standards that define what 
it means in each language may still differ greatly - and there is a clear 
benefit to each compiler following the relevant underlying concepts 
directly, rather than just one set of concepts and trying to shoehorn the 
other on as a set of exceptions to those concepts.

There are many other standards layered on the existing C and C++ 
standards, which do not necessarily get updated for new standard versions, 
and users with code written and qualified for particular past standard 
versions, effectively meaning that the multiple C versions need supporting 
indefinitely (and note C90 is more widely used than C99) and when there is 
a new C++ version (one with new features as opposed to a defect-fix 
release such as C++03) there will also be a need for support of multiple 
C++ versions.

Of course code should be shared where appropriate and where it doesn't 
adversely affect maintenance.  For example, the preprocessor concepts are 
sufficiently nearly identical in the different standards that the 
preprocessor is usefully shared.  I am confident that in future the 
cp_lexer_* layer will be usable for C as well; the c_lexer_* layer in the 
new C parser is much simplified from what is there for C++ and is done 
that way to avoid combining other changes (e.g. lexing up front) not 
strictly needing to be combined with a new parser, but it is not something 
that need be different permanently.  C only needs 2-token look-ahead 
unlike the unlimited look-ahead needed for parsing C++, which makes things 
simpler, but with lexing up front I don't expect the simplicity will 
actually provide any performance advantages.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

  parent reply	other threads:[~2004-10-26  0:03 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-23  1:25 Joseph S. Myers
2004-10-23  2:39 ` Steven Bosscher
2004-10-23  4:15   ` Joseph S. Myers
2004-10-23  5:44 ` Scott Robert Ladd
2004-10-24 22:49 ` Joseph S. Myers
2004-10-26  0:32   ` Zack Weinberg
2004-10-26  1:03     ` Andrew Pinski
2004-10-26  1:03       ` Zack Weinberg
2004-10-26  1:11         ` Joseph S. Myers
2004-10-26  8:23           ` Zack Weinberg
2004-10-26  1:30       ` Gabriel Dos Reis
2004-10-26  1:06     ` Joseph S. Myers
2004-10-26  2:47       ` Joseph S. Myers
2004-10-26  3:48         ` Mark Mitchell
2004-10-26 12:21       ` Kyuupi
2004-10-26 12:32         ` Joseph S. Myers
2004-10-26 11:42     ` Joseph S. Myers
2004-10-27 19:04     ` Richard Henderson
2004-10-27 19:11       ` Richard Guenther
2004-10-27 19:41         ` Zack Weinberg
2004-10-27 19:31       ` Zack Weinberg
2004-10-27 21:31         ` Richard Henderson
2004-10-28  7:38           ` Alan Modra
2004-10-27 20:25   ` Joseph S. Myers
2004-10-25 22:33 ` Ziemowit Laski
2004-10-25 22:51   ` Joseph S. Myers
2004-10-25 23:45     ` Ziemowit Laski
2004-10-25 23:53       ` Scott Robert Ladd
2004-10-26  0:03         ` Unified front end for C and C++ (was Re: New C parser [patch]) Matt Austern
2004-10-26  1:26           ` Scott Robert Ladd
2004-10-26  1:43             ` Gabriel Dos Reis
2004-10-26  2:01               ` Scott Robert Ladd
2004-10-26 15:38                 ` Gabriel Dos Reis
2004-10-26  0:28         ` New C parser [patch] Ziemowit Laski
2004-10-26  1:20           ` Scott Robert Ladd
2004-10-26  6:08             ` Unified C and C++ front end (was Re: New C parser [patch]) Matt Austern
2004-10-26 11:14               ` Joseph S. Myers
2004-10-26 16:04                 ` Gabriel Dos Reis
2004-10-26 16:51                   ` Joseph S. Myers
2004-10-26  0:37         ` Joseph S. Myers [this message]
2004-10-26  0:03     ` New C parser [patch] Stan Shebs
2004-10-26  1:46       ` Gabriel Dos Reis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0410252343480.11937@digraph.polyomino.org.uk \
    --to=jsm@polyomino.org.uk \
    --cc=coyote@coyotegulch.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=zlaski@apple.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).