Re: Why do we have Dmain?

2021-10-25 Thread SealabJaster via Digitalmars-d-learn
On Monday, 25 October 2021 at 07:49:44 UTC, user1234 wrote: in addition to the other answers, there's also the parameters of main: Also, all programs running under the D runtime have special command line arguments(`--DRT` arguments). The Runtime needs to be able to parse those arguments at

Re: Why do we have Dmain?

2021-10-25 Thread bauss via Digitalmars-d-learn
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

Re: Why do we have Dmain?

2021-10-25 Thread user1234 via Digitalmars-d-learn
On Friday, 22 October 2021 at 05:54:21 UTC, Kirill wrote: I am not a compiler expert, but I genuinely would like to know why we have Dmain. I've been looking at the generated assembly code recently and noticed the _Dmain function. I didn't notice it before. Then there is main, where Dmain is

Re: Why do we have Dmain?

2021-10-22 Thread Elronnd via Digitalmars-d-learn
On Friday, 22 October 2021 at 09:01:53 UTC, Kagamin wrote: Actually C runtime is many megabytes in size. A couple of samples: $ wc -c /usr/lib/libc-2.33.so 2150424 /usr/lib/libc-2.33.so % wc -c /lib/libc.so.7 1981952 /lib/libc.so.7 I would hardly call two megabytes 'many'.

Re: Why do we have Dmain?

2021-10-22 Thread Kagamin via Digitalmars-d-learn
Actually C runtime is many megabytes in size.

Re: Why do we have Dmain?

2021-10-22 Thread Dukc via Digitalmars-d-learn
On Friday, 22 October 2021 at 07:00:25 UTC, Mike Parker wrote: The entry point for your program is a function `_start`. That's implemented in the C runtime, which all D programs depend on. It in turn calls `main`, as it does for C and C++ programs. It is possible, in both C and D, to write

Re: Why do we have Dmain?

2021-10-22 Thread Kirill via Digitalmars-d-learn
On Friday, 22 October 2021 at 07:00:25 UTC, Mike Parker wrote: [...] Thank you for such a clear explanation Mike and for a quick reply!

Re: Why do we have Dmain?

2021-10-22 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 October 2021 at 05:54:21 UTC, Kirill wrote: I am not a compiler expert, but I genuinely would like to know why we have Dmain. I've been looking at the generated assembly code recently and noticed the _Dmain function. I didn't notice it before. Then there is main, where Dmain is