No main() Error
Ron Tarrant
rontarrant at gmail.com
Sun Feb 2 10:06:29 UTC 2025
I'd like to suggest that an error condition be added wherein, if
there is no main() function, the compiler will treat this as a
fundamental error and report it upon exit.
Most of the code I write these days is in Python. I turned to D
for a small project this morning and while doing some preliminary
exploration into file handling, I got a "Declaration expected"
error while trying to write a foreach() loop.
What it turned out to be is that I'd forgotten to wrap my code in
a main() function. Dumb mistake, not the kind of mistake most
would make. I'm too used to writing in Python, I guess.
I expect most people reading this will think this is so
fundamental as to not be needed, but I'm hoping to avoid, in
future, going around in circles for an hour and a half while
trying to do something so trivial.
Thank you for your kind consideration of this matter.
More information about the dip.ideas
mailing list