Re:Who Needs Main() Anyway?
by MathMonkeyMan on Saturday January 21, 2023 @12:58PM
(#34468448)
It's the same as in C. The observation here is that variables with static storage duration can be initialized by running user code before main() begins.
[ Parent
| on HN ]
Oh! Thank you. That makes much more sense now.
Re:Who Needs Main() Anyway?
by colejohnson66 on Sunday January 22, 2023 @01:48PM
(#34480807)
It’s also the same in .NET. If your Main() function references types that have a static constructor, the constructors could run before Main().
It’s a surprising thing when one first discovers it, but it makes a lot of sense.