www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What are the advantages of using betterC?

reply Rempas <rempas tutanota.com> writes:
Sorry if that's a stupid question but I've read 
[this](https://dlang.org/spec/betterc.html) post that talks about 
betterC but I didn't understand where betterC is being used and 
what are the advantages it gives. Can anyone help me out with 
this?
Jan 19 2021
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
betterC is a niche restricted feature set. If you don't already 
have a use case in mind, I'd recommend avoiding it.

It is for cases where you're stuck with certain limitations to 
integrate with the outside world. Like running on peculiar 
hardware or interoperating with certain outside programs where 
you can't initialize the runtime properly (and even then, you 
might be better off going with a custom minimal runtime over the 
betterC prepackaged restrictions).

Some libraries try to be compatible with it so they can be used 
in those special cases too, but you probably don't need it.
Jan 19 2021
parent reply Rempas <rempas tutanota.com> writes:
On Tuesday, 19 January 2021 at 17:40:52 UTC, Adam D. Ruppe wrote:
 betterC is a niche restricted feature set. If you don't already 
 have a use case in mind, I'd recommend avoiding it.

 It is for cases where you're stuck with certain limitations to 
 integrate with the outside world. Like running on peculiar 
 hardware or interoperating with certain outside programs where 
 you can't initialize the runtime properly (and even then, you 
 might be better off going with a custom minimal runtime over 
 the betterC prepackaged restrictions).

 Some libraries try to be compatible with it so they can be used 
 in those special cases too, but you probably don't need it.
Oh ok! So there is not advantage from using it like faster compile time, better performance etc. right?
Jan 19 2021
next sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 19 January 2021 at 17:44:03 UTC, Rempas wrote:
 On Tuesday, 19 January 2021 at 17:40:52 UTC, Adam D. Ruppe 
 wrote:
 betterC is a niche restricted feature set. If you don't 
 already have a use case in mind, I'd recommend avoiding it.

 It is for cases where you're stuck with certain limitations to 
 integrate with the outside world. Like running on peculiar 
 hardware or interoperating with certain outside programs where 
 you can't initialize the runtime properly (and even then, you 
 might be better off going with a custom minimal runtime over 
 the betterC prepackaged restrictions).

 Some libraries try to be compatible with it so they can be 
 used in those special cases too, but you probably don't need 
 it.
Oh ok! So there is not advantage from using it like faster compile time, better performance etc. right?
Not really
Jan 19 2021
prev sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Tuesday, 19 January 2021 at 17:44:03 UTC, Rempas wrote:
 Oh ok! So there is not advantage from using it like faster 
 compile time, better performance etc. right?
The default betterC build will compile about a quarter second faster than the default normal D build, but runtime performance is always the same, and you can get that quicker build with normal D too if you customize your build a little. And besides a quarter second is prolly worth it to use full D...
Jan 19 2021
parent Rempas <rempas tutanota.com> writes:
On Tuesday, 19 January 2021 at 18:04:42 UTC, Adam D. Ruppe wrote:
 On Tuesday, 19 January 2021 at 17:44:03 UTC, Rempas wrote:
 Oh ok! So there is not advantage from using it like faster 
 compile time, better performance etc. right?
The default betterC build will compile about a quarter second faster than the default normal D build, but runtime performance is always the same, and you can get that quicker build with normal D too if you customize your build a little. And besides a quarter second is prolly worth it to use full D...
Totally agree! It doesn't worth it! Thanks a lot for the info man!
Jan 19 2021