tfw nerd corner inc
nézegettem CIL-t elég deep szinten és 2 nap után feltűnt hogy nem optimalizál ki valamit
mondom ez így nem maradhat, lebontottam mindent vissza Hello World szintre kb

ez lett belőle, lényegében ugyan az mintha assembly lenne

mondom wtf hogy kiszedi a stackből a szöveget local varba
aztán meg visszateszi a stack-be
csak azért hogy létezzen az az s változó amit leírtam
végülis csak 1.5 órája guglizok és próbáltam mindent hogy eltűntessem, és kiderült hogy a JIT optimalizálja le mikor ezt fordítja át a Runtime asmre, és a Reflection miatt hagyják ott ._.
sry ezt ki kellett adni magamból
dammit chloe.
Quote
Közzétette Microsoft ekkor: 2010.06.03., 15:35
Hi Grumpydev. Good observation. What you're observing is actually a difference in the semantics of the two languages.
C# specification $7.5.1.2 says "the expressions or variable references of an argument list are evaluated in order, from left to right". In this simple example it doesn't matter and could have been optimized as you describe, but in general the arguments might have side effects and so it does matter. There isn't great benefit in having the compiler optimize the IL as you describe -- that's more appropriately the domain of the JIT (and once it compiles to registers then the optimization's already done!)
VB specification $11.8 says "arguments are evaluated in the order in which the corresponding parameters are declared in the target method".
This post was edited by Anarkin on Jul 10 2013 07:10am