On Tuesday, January 28, 2025 6:01:56 AM MST DLearner via Digitalmars-d-learn wrote: > Is there a definitive list somewhere of standard library > functions that work with -betterC? > > For example, the following code fragment (taken from the library > docs) does not work with -betterC. > ``` > extern(C) void main() { > import std.container.array; > > auto arr = Array!int(0, 2, 3); > > > } > ```
No, certainly not an official one, and it arguably wouldn't make sense to make one, because we do not support -betterC with druntimte or Phobos, and for the most part, anywhere it works is accidental. In a few cases, someone went in and explicitly made something work with -betterC, but we provide no guarantees that any code that works with -betterC right now will continue to do so, and we do not intend to add -betterC support. So, if you use something from Phobos that happens to work with -betterC today, it could stop working with -betterC tomorrow if a change is made to fix or improve something, and it's not compatible with -betterC. -betterC was originally intended to be a tool for making it easier to port C code to D code (after which, the idea was that -betterC would no longer be used, and you would just have a normal D program). It was never the goal to use it to create a secondary version of D. Some folks have elected to use it that way, and that's fine, but you're basically on your own if you're using -betterC. The compiler is really the only thing that explicitly supports it, and of course, it doesn't support all D features with it, because it can't. The closest that you're likely to ever get for -betterC support is that we want to try to make it so that stuff in druntime is more pay as you go - that is, if it really doesn't need something, it doesn't pull it in, so you then hopefully you don't pull in code that you're not using - and that would naturally make more stuff work with -betterC, but we're not going to explicitly support -betterC with druntime or Phobos. - Jonathan M Davis