emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++1x support?


From: Daniel Colascione
Subject: C++1x support?
Date: Fri, 04 Dec 2009 01:13:19 -0500
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

With upcoming versions of gcc and the-compiler-which-shan't-be-named
supporting huge swaths of the next C++ standard, it's probably
worthwhile to start talking about how to support it.

I've made a short of the things that do and don't work with the current
cc-mode.

Is anyone working on these?


WHAT WORKS:
rvalue references (which are spelled with double ampersands) are fine.

user-defined literals and most new string prefixes work fine.

range-based for loops are fontified correctly as far as I can tell.

Amazingly, lambas seem to work (though the new-style return type
specification isn't fontified properly: that is, in

[](int x,
   int y,
   int z) -> obj
    {
        int z = x + y; return z + x;
    }

obj should be fontified as a type.)




WHAT DOESN'T WORK:

New Keywords:
There are new keywords constexpr, nullptr, static_assert, and decltype,
but adding those should be trivial.


New template parsing rules:
'>>' now being parsed as a template argument list ender instead of a
right shift


Type inference:
auto x = somefunction(); // compiler infers type of x

cc-mode highlights x as a type.


Variadic templates:
template<typename... Args> void printf(const char* fmt, Args... args);

cc-mode copes with the function arguments, but it just gives up on the
template arguments. Also, forward-sexp doesn't move over 'Args...': it
stops before the dots.


New strings:
I have a feeling this one might be painful. C++0x has raw strings:
(from Wikipedia)

u8R"XXX[I'm a "raw UTF-8" string.]XXX"
uR"address@hidden is a "raw UTF-16" string.]*@"
UR"[This is a "raw UTF-32" string.]"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAksYqH8ACgkQ17c2LVA10VuD8gCgpGdJPc9iHiN3TwyRiWYH9UGY
U7gAn2aA8krugJ5NeNS5Sp5V38CC62+E
=0hgf
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]