Why do we have Dmain?

bauss jj_1337 at live.dk
Mon Oct 25 10:49:34 UTC 2021

On Monday, 25 October 2021 at 07:49:44 UTC, user1234 wrote:
> so with the D main you're directly in the the D "domain". In 
> theory from that point, you don't need to ever use `strlen` for 
> example.

Not just that, but you shouldn't use it at all, rather you can't 
use it!

You might be able to call it, but it won't work as expected 
because strings are not zero-terminated in D, unless the string 
is a literal.

strlen looks for \0, so using it for a string that isn't 
zero-terminated is asking for trouble.

More information about the Digitalmars-d-learn mailing list