Replies: 2 comments 1 reply
-
right now in opend, the deprecation is silenced if the size of the array is known at compile time still there if it is only known at runtime
but if it just |
Beta Was this translation helpful? Give feedback.
-
I think I got it figured out. It puts in an assert for the length before the foreach if you use a particular size like steven suggested in that thread:
It automatically inserts this at the loop entry:
So you run it and get, at runtime:
So this lets it compile but still checks for the bound trouble. that sound ok? (of course also works with int and whatnot just ubyte length less likely to explode my ram lol) |
Beta Was this translation helpful? Give feedback.
-
Based on https://forum.dlang.org/thread/[email protected]
Currently working with foreach loops in D is ugly, because
foreach(int i, el; myArray)
is deprecated andforeach(i, el; myArray)
is PITA becausei
isulong
now, and I rarely need ulong in my loops. Even worse, many 3rdp libs won't acceptulong
, so I have to do tons of casts toint
.The discussion on the D forum went nowhere
Beta Was this translation helpful? Give feedback.
All reactions