r/cpp • • Sep 30 '26

EDG C++ fronted now released as open source

https://edgcpp.org/#transition
214 Upvotes

49 comments sorted by

75

u/STL MSVC STL Dev Sep 30 '26

Yay! Maybe I'll finally get fixes for all of the EDG bugs we've reported (microsoft/STL#1621), and of course modules!

4

u/splicer13 Oct 01 '26

I would say that companies generally used EDG when they didn't want to spend resources on other ways of having a compiler frontend. So these companies aren't necessarily going to immediately see the light and contribute upstream changes to improve EDG. In fact I think it's unlikely they would do so.

I think what is likely to happen is that none of the EDG customers commit resources to improving it for anything other than their immediate needs, until the problem gets so big they are forced to make the transition to clang.

6

u/pjmlp Oct 02 '26

This won't solve much, see how many companies have switched their proprietary compilers to proprietary forks from clang, and still hardly contribute anything upstream other than LLVM improvements to support their hardware.

32

u/kronicum Sep 30 '26

Will Microsoft contribute to free EDG?

7

u/domiran game engine dev Sep 30 '26

This would be so fabulous. 😭

6

u/kal_at_kalx_net Oct 02 '26

Honest question. Did EDG give Microsoft an estimate for how much it would cost to resolve these issues when you pointed them out?

4

u/STL MSVC STL Dev Oct 02 '26

I respectfully decline to comment.

3

u/arthurno1 Oct 04 '26

Respectfully you just commented :)

5

u/notthatsocrates Sep 30 '26

Only two days ago I stopped on their website and clicked on Licensing. Not available to mere mortals. Back in the day, IIRC, HP aCC and Intel C++ compilers both used EDG as a front end.

9

u/STL MSVC STL Dev Sep 30 '26

That's correct for Intel's C++ compiler, at least (don't know anything about HP). They switched from EDG to LLVM a few years ago. (I happen to know this because we minimally interact with Intel's C++ compiler in MSVC's STL.)

CUDA's C++ compiler (nvcc) is still powered by EDG to my knowledge.

10

u/c0r3ntin Sep 30 '26

LLVM/Clang will conquer all!

4

u/pjmlp Oct 02 '26

It eventually might, now if all companies with proprietary closed forks, thanks license, will bother to contribute upstream, that is another matter.

3

u/notthatsocrates Sep 30 '26

We used EDG eccp to check for conformance before filing bug reports against other compilers. One single product (which later became stdcxx under Apache's umbrella) was compiling with EDG's routinely.

5

u/gracicot Oct 01 '26

I'd be interested to see the EDG frontend being used with an LLVM back-end, it would make it usable to produce binaries on most platforms

3

u/azswcowboy Sep 30 '26

In the current day, afaik Coverity (black duck software now) still uses EDG as a front end. As an early adopter of recent standards it’s painful how much code isn’t handled properly. I’m sure when reflection or contracts code is added it’ll blow up again…

7

u/igaztanaga Oct 01 '26

EDG is used in several static analysis and testing products (https://en.eeworld.com.cn/news/qrs/eic671028.html), and some embedded compilers like Green Hills.

81

u/VinnieFalco wg21.org | corosio.org Sep 30 '26

We were hoping to announce it ourselves, and I guess this works well enough.

The EDG C++ frontend compiler is now an open-sourced, fiscally sponsored project of The C++ Alliance.

18

u/kal_at_kalx_net Oct 01 '26

The Edison Design Group story is amazing. Greg Comeau clued me in when we were early panix.com users. C++ seems to be a magnet for smart people.

9

u/igaztanaga Sep 30 '26

Amazing news. And curious to see their famous C-generating back end!

12

u/GrammelHupfNockler Sep 30 '26

I love to hear that, now all of my frequently used compilers' frontends are based on OSS (MSVC and nvcc being the last ones missing). The website reads so painfully sloppy though 😢

11

u/splicer13 Sep 30 '26

nvcc is based on edg.

3

u/GrammelHupfNockler Oct 01 '26

yeah, as I've been saying šŸ˜…

5

u/jwezorek Sep 30 '26

Doesn't Visual Studio use EDG too? or just for intellisense?

31

u/STL MSVC STL Dev Sep 30 '26

VS (and VS Code's C/C++ Extension) use EDG only for IntelliSense. Normal builds use Microsoft's "C1XX" frontend.

The cl.exe compiler driver can actually run the EDG frontend in a compile-only mode via an undocumented, unsupported option /BE. In the STL we use this extensively to validate that our sources can be parsed via IntelliSense (and that we work around EDG's compiler bugs). However, EDG is not hooked up to the compiler backend C2, and is completely unable to be used for codegen.

21

u/n1ghtyunso Oct 01 '26

The cl.exe compiler driver can actually run the EDG frontend in a compile-only mode via an undocumented, unsupported option /BE

Not anymore. Its documented now.
Hyrums law ensues. šŸ˜„

3

u/hansw2000 Oct 02 '26

clang-cl support (for parsing the flag) seems essential: https://github.com/llvm/llvm-project/pull/228381

6

u/chibuku_chauya Oct 01 '26

Very nice to see EDG accessible to us regular joes at long last. I’ve always liked this frontend.

5

u/delta_p_delta_x Sep 30 '26

The first thing I'm going to do is grep through the source for C++20 modules and ranges code.

8

u/daveedvdv EDG front end dev, WG21 DG Oct 01 '26

C++20 modules, I understand (the main files contain the word `modules`; so not too hard to find; I'm not very familiar with those).
But "ranges" is a library feature... this does not include a standard library (other than a few components tightly connected to the core language, like <initializer_list> or <typeinfo>).

6

u/kronicum Sep 30 '26

This is huge.
Many seismic shifts happening on the C++ planet lately.

2

u/SignalDepth6131 Oct 20 '26

One thing I've been hearing a lot: EDG's clear code structure and extensive documentation make it easier for contributors to understand how the front end works, identify where changes belong, and extend its implementation.
If interested, I've written a short blog post about feature ideas here: https://cppalliance.org/newsmedia/news/edg-is-now-open-source-heres-what-comes-next/

1

u/Apart_Ebb_9867 Sep 30 '26

the website of edg claims ā€œThe code is written in C++11ā€, but all I can see is plain C. Am I looking at the wrong place?

8

u/Nobody_1707 Oct 01 '26

2

u/13steinj Oct 03 '26

I wonder if that's a filesystem case sensitivity issue (.C is a known, possibly unpopular, file extension for C++).

1

u/Apart_Ebb_9867 Oct 01 '26

That’s lib_src which I presume is some library for supporting the generated AST or C (depending on how the frontend is used, can do both). But in src I don’t see any evidence of C++, but haven’t looked everywhere.

7

u/daveedvdv EDG front end dev, WG21 DG Oct 01 '26

lib_src/ implements a minimal run-time support library. Things like dynamic_cast, operator new, etc. It's mostly for demonstration purposes. Our customers generally either provided their own (if they were compiler vendors) or didn't need it (if they were non-compiler tool vendors).

2

u/Nobody_1707 Oct 01 '26 edited Oct 01 '26

attribute.c uses constexpr, but I suppose they could be using c23.

EDIT: It's definitely just C++11 in .c files. It's just very C flavored C++11.

https://github.com/edgcpp/compiler/blob/main/src/modules.c

16

u/daveedvdv EDG front end dev, WG21 DG Oct 01 '26

For the first 30 years or so, it was C89 code. Then we switched to C++11, but to minimize disruption to customers, we kept the file extensions unchanged. C++ was only introduced in new code, and even for new code we often stuck to existing C-based idioms. The modules code started after the switch to C++, and so has more of a C++ flavor.

3

u/Apart_Ebb_9867 Oct 01 '26 edited Oct 01 '26

No, they do compile with a C++ compiler, in the cmake files they have ā€œset_source_files_properties(${ALL_C_FILES} PROPERTIES LANGUAGE CXX)ā€. But claiming that something is written in C++ 11 just because is compiled by a C++11 compiler seems a stretch to me. The constexpr must have escaped code reviews because everywhere they are solidly C, even when obvious C++ alternatives would be simpler, like in the typedefs for structs.

2

u/Apart_Ebb_9867 Oct 01 '26

Yep, module.c seems more C++ than the rest.

1

u/ts826848 Oct 01 '26

header_util.h has two templates (Value_saver and Opt) that are used in a fair number of other files.

1

u/CPlusPlusPadawan Oct 19 '26

1

u/STL MSVC STL Dev Oct 19 '26

Chrome has no issue with that Let's Encrypt certificate.

1

u/13steinj Oct 01 '26

Is the repo really so heavy as to suggest --filter=blob:none ?

I get that there's a bunch of history, but that's just surprising.

6

u/daveedvdv EDG front end dev, WG21 DG Oct 01 '26

Not that heavy. But it does make things quite a bit swifter. But, by all means, if you have a few minutes, go ahead and fetch the whole thing!

3

u/13steinj Oct 02 '26

The git objects are ~225MB. If I git repack -a -d -f --depth=250 --window=250 --path-walk (the last arg is new to git 2.56, supposedly more optimal), the git objects size drops by ~30%. I do not know what it would take to get a repack on github outside of archiving and reuploading the repo, but it might be worth doing.

3

u/daveedvdv EDG front end dev, WG21 DG Oct 02 '26

Thanks for that info. I'm not at all knowledgeable about git, but I forwarded your findings to Wyatt, who did most of the prep work for the open-sourcing.

3

u/UnusualPace679 Oct 01 '26

FWIW the repo's git objects are ~200MB in total.

-1

u/Significant_Neat6476 Oct 03 '26

At a risk sounding ignorant - why C++ development world would actually care? Nobody developing in C++ commercially with GCC, Clang or MSVC really cares about EDG which is not a compiler, does not define a standard compiler or does not influence most commercial systems building real world C++ applications.