On 5/11/20 9:54 PM, WhatMeWorry wrote:

I'm trying to study Adam Ruppe's terminal.d sub-package and I see the following code segment:

version(demos) unittest
{
     import arsd.terminal;

     void main()
     {
         // . . .
     }

     main; // exclude from docs
}

Looks like a good baby step to take, so in the command line I use:

C:\dub\path\to\arsdpackage\arsd-official>dmd terminal.d -unittest -version=demos
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 134: No Start Address


Shouldn't the version identifier demos and the unittest option activate the test block and therefore defines main() which then give the "Start Address"?

That is not a global main, it is inside a unittest block. A unittest block is actually a function. So the main there is a nested function, and not the one that D declares as the entry point.

Also, what is the isolated main; command right after the main function?

It's calling the inner function. But I'm sure you would realize that if you knew that it's not the true main function.

-Steve

Reply via email to