Foreach with byte problems
Steven Schveighoffer
schveiguy at yahoo.com
Fri Feb 25 12:12:02 PST 2011
On Fri, 25 Feb 2011 14:51:18 -0500, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> On 2/25/11, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>> a dirty trick you could do is add 0, which should promote the arg to
>> int.
>
> Cool. I've almost used +1-1, LOL!
>
> Well, I thought DMD would simply ignore +0 (dead code elimination?),
> but apparently this is a cool shorthand for casting literals? Nice.
No code is generated to add 0, but it does affect the type.
-Steve
More information about the Digitalmars-d-learn
mailing list