On Monday, June 11, 2012 01:35:41 Timon Gehr wrote: > On 06/11/2012 12:28 AM, Mehrdad wrote: > > Ugh... you keep on saying "on occasion" and "particular case", making it > > seem like it's such a rarity that it's not worth mentioning. > > > > > > > > Regarding your examples: the rule is quite simple: > > > > - Literals are static by default > > - If they are to be assigned to a dynamic array, then make them dynamic > > instead > > > > > > > > But I really don't understand what benefit you get by making them > > dynamic by DEFAULT... and your answer didn't tell me anything, other > > than "most of the time you're assigning them to dynamic arrays" (which > > tells me nothing about the benefits). > > Type deduction.
Exactly. And if they need to be assigned to a static array, then the compiler can automatically do what it needs to do to avoid the extra heap allocation. - Jonathan M Davis
