all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Stephen J. Turnbull" <stephen@xemacs.org>
To: rms@gnu.org
Cc: Helmut Eller <eller.helmut@gmail.com>, emacs-devel@gnu.org
Subject: Re: Finding objects on C stack - alternate GCPRO
Date: Thu, 17 Nov 2011 13:17:37 +0900	[thread overview]
Message-ID: <87pqgridr2.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <E1RQosw-0004Bo-GJ@fencepost.gnu.org>

Richard Stallman writes:

 > Please don't make Emacs use C++.  C++ is an ugly and clumsy language.

Except where it isn't.

XEmacs code is required to compile with both C (specifically C89,
thought there has been discussion recently of preferring C99) and C++
(IIRC this dialect was named "Clean C" by Martin Buchholz).  This has
two advantages in our practice: (1) the stricter typing rules of C++
catch some bugs[1], and (2) some things that are impossible to express
cleanly in C (specifically, typeof(Emacs character) != EMACS_INT,
which has been very useful in completely preventing certain Mule bugs
that have regressed frequently in Emacs's implementation) can be
implemented in the C++ build, and therefore type-checked.

Granted, the code needed to implement such a type in C++ is very
redundant if not specifically ugly, but it's really a unit test for a
"unit" that pervades text manipulation code rather than being
modularized into a few files.  It's nice if test code can be clean and
pretty, but when necessary I don't have a problem with gymnastics in
test code.  On the other hand, the code that actually implements
XEmacs functionality still compiles (and works correctly! :-) with C
and "typedef EMACS_INT Ichar" (where Ichar is our typedef for the
internal representation of the character type).

If C++ makes it possible to write *functionally better* allocation and
garbage collection code in a clean and intelligible way, I would be in
favor of relaxing the prohibition of C++ for *specified* files and
*specified* C++ idioms.

Footnotes: 
[1]  I don't know if this is still true for the most recent, tighter C
standard, but in our code --std=C99 does not catch all the common bugs
that a C++ build does.




  reply	other threads:[~2011-11-17  4:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16 10:07 Finding objects on C stack - alternate GCPRO Dmitry Antipov
2011-11-16 10:18 ` Helmut Eller
2011-11-16 10:33   ` Dmitry Antipov
2011-11-16 23:27   ` Richard Stallman
2011-11-17  4:17     ` Stephen J. Turnbull [this message]
2011-11-17 19:12       ` Richard Stallman
2011-11-16 11:06 ` Eli Zaretskii
2011-11-17 12:50   ` Stephen Berman
2011-11-17 16:50     ` Eli Zaretskii
2011-11-16 14:41 ` Stefan Monnier
2011-11-16 18:19 ` Tom Tromey
2011-11-16 21:07 ` Ken Raeburn

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=87pqgridr2.fsf@uwakimon.sk.tsukuba.ac.jp \
    --to=stephen@xemacs.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.