On Friday, 3 March 2023 at 01:21:52 UTC, ryuukk_ wrote:
I have some questions:

1. why does it work with LDC?
2. why does it work with DMD when build/link in 2 step?
3. why it doesn't work when DMD is invoked once for build/link

I think these are probably coincidences and the answer can be summarized as "that's what ends up happening due to the details of the implementation".

4. is this a bug in DMD or my code is wrong?

I would say the code is wrong in principle, though as you've noted it can still work in some specific circumstances.

5. if it's wrong, then why does it compile/no error?

`extern(C) main` is a low-level feature, because it effectively turns off parts of the language. However, the rest of the program doesn't know that this is the case - currently the compiler simply assumes you know what you're doing. Maybe it's not OK that it's easy to use it by accident.

  • Re: Bug in DMD? Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: Bug in ... ryuukk_ via Digitalmars-d-learn
      • Re: Bug... ryuukk_ via Digitalmars-d-learn
        • Re:... H. S. Teoh via Digitalmars-d-learn
        • Re:... ryuukk_ via Digitalmars-d-learn
          • ... Ali Çehreli via Digitalmars-d-learn
          • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
            • ... ryuukk_ via Digitalmars-d-learn
              • ... Vladimir Panteleev via Digitalmars-d-learn
              • ... ryuukk_ via Digitalmars-d-learn
              • ... Vladimir Panteleev via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... ryuukk_ via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... ryuukk_ via Digitalmars-d-learn
      • Re: Bug... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

Reply via email to