do I incur a penality on compile time if I explicitly declare default behavior ?

max haughton maxhaton at gmail.com
Tue Jun 22 18:31:12 UTC 2021


On Monday, 21 June 2021 at 04:12:55 UTC, someone wrote:
> I mean, coding as following:
>
> ```d
> int intWhatever = 0; /// default being zero anyway
>
> foreach (classComputer objComputer, objComputers) { ... } /// 
> explicitly declaring the type instead of letting the compiler 
> to figure it out
>
> struc Whatever {
>
>    public doSomething() { ... } /// explicitly declaring scopes 
> matching the default ones
>
> }
>
> string[] strWhatever;
> if (strWhatever.length > cast(size_t) 1) { ... } /// explicitly 
> casting for proper types although not required to at all
> ```
>
> ... and the likes; or, besides unnecessary typing, are there 
> any cons that I should be aware of while using DMD ?

Short answer: No

Longer answer: Still no but it does exercise different code in 
the compiler which you could measure if you were mad.


More information about the Digitalmars-d-learn mailing list