No main() Error

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Feb 4 09:20:17 UTC 2025


On 04/02/2025 10:16 PM, Ron Tarrant wrote:
> On Sunday, 2 February 2025 at 10:14:15 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> Due to separate compilation, the D compiler cannot know if a start 
>> address exists with a function provided for it.
>>
>> The responsibility of this is the linker, which will error if no start 
>> address with executable code is provided.
> 
> I guess I'm not being very clear. I'll try again...
> 
> On the first pass, I'd like to suggest that the compiler could check for 
> an occurrence of "main" followed by "(" and spit out an error if it's 
> not found.
> 
> Any of the following would avoid the error:
> 
> ```
> void main(
> 
> <returned type> main (
> 
> void main  (
> ```
> 
> And other variations thereof.

What do you mean by first pass?

The reasons for this to not work is because the compiler cannot do it, 
only the linker has the information needed to emit an error.

Syntax does not play a role in this.



More information about the dip.ideas mailing list