Should the comma operator be removed in D2?
retard
re at tard.com.invalid
Tue Nov 17 15:34:32 PST 2009
Tue, 17 Nov 2009 15:04:01 -0800, Bill Baxter wrote:
> On Tue, Nov 17, 2009 at 2:53 PM, Robert Jacques <sandford at jhu.edu>
>> *sigh* The reason the compiler would have to create a temporary struct,
>> is because that's what a tuple is at runtime. Tuples need to be compact
>> (like structs) so that they can be passed to functions, etc.
>
> Sigh back at ya. I think all of us are just assuming that the compiler
> will be smart enough to realize that the tuple value is not being used
> and optimize it away.
> It should be fairly trivial to detect and handle appropriately. At
> least in the case of that for loop there. I think unused value
> elimination is probably one of the first things you study in compiler
> classes on optimization. It must be because even *I* know about it and
> I've only taken one compiler class that barely touched on optimization
> at all. :-)
Elimination of unused values has been one of the basic optimizations in C
compilers for decades. E.g. gcc 4.4 does tremendous amounts of
optimizations and the constant folding logic might even optimize away the
whole 'for' loop, the function containing the for loop or even the whole
object file containing the function.
If this kind of argumentation is used against new features, almost every
high level feature in D should be shaved off - classes, scope statements,
all literals etc. There is a serious amount of extra code those produce
compared to a hand crafted asm version of the program.
More information about the Digitalmars-d
mailing list