[cfe-dev] C++/CLI (Ecma 372) support in Clang
Douglas Gregor
dgregor at apple.com
Fri Jul 20 08:24:27 PDT 2012
On Jul 20, 2012, at 6:20 AM, João Matos <ripzonetriton at gmail.com> wrote:
>> It's a fairly extensive and complicated extension to C++, and it seems unlikely that Clang will ever actually be a useful C++/CLI compiler. Moreover, the advent of C++/CX and the recent push toward native code makes the long-term future of C++/CLI completely unclear, and I'd rather not have us chasing yesterday's technology.
>
> Native and managed code have different advantages, so I don't see
> managed code getting replaced by native code soon. What I see is
> native code being used for the lower level parts of software where
> performance really matters, with a managed layer for extensibility-
> and C++/CLI is the bridge. I do get your point though, and agree that
> the drawbacks might outweigh the benefits.
Just so my point hasn't been lost: for the Clang community, I believe that C++/CX is both more tractable and more useful than C++/CLI.
>> C++/CX seems like a more reasonable goal for Clang as a project, because (1) it's more conceivable that we could actually provide a useful C++/CX compilation environment, and (2) it seems to be the new direction for Microsoft. Plus, I think it might be a little smaller and, therefore, slightly easier to implement.
>
> In terms of complexity, they both seem really similiar syntax-wise.
Syntax is the easy part.
> MS
> has re-used most of their previous work on C++/CLI for C++/CX, here is
> a summary of differences:
>
> Lifetime management:
> CLI: Garbage collected
> CX: Refcounted
Clang has lots of infrastructure for dealing with refcounted types (see Objective-C ARC) that could easily be generalized. GC would require quite a bit of work.
> Code generation:
> CLI: MSIL + native code. Can create a cross-platform binary if MSIL-only.
> CX: Native code only. Binaries target a specific platform.
Targeting MSIL, and doing it well, would be a pile of work.
> Ref to ^:
> CLI: R^%
> CX: R^&
This makes my eyes bleed :(
> Generics:
> CLI: Generics classes, interfaces & delegates allowed.
> CX: Generic interfaces & delegates only.
Eliminating generic classes simplifies semantic analysis and IR generation quite a bit.
- Doug
More information about the cfe-dev
mailing list