▲ | konstantinua00 3 days ago | ||||||||||||||||
one thing I never understood about VLAs - discussion about them always hits a "can't put it on stack safely" and gets halted, forever why not to make it heap-only type? it seems such a useful addition to type system, why ignore it due to one usecase? | |||||||||||||||||
▲ | Out_of_Characte 3 days ago | parent | next [-] | ||||||||||||||||
Because arrays simply do not deal with fragmentation. Yes, you could probaly get decent performance on a modern system that has memory overcommit strategy where you could allocate sparse adress ranges where you would probaly never run out of pointers unless you actually write to your variable array. But its just kind of mediocre and you're better off actually dealing with the stack if you can actually deal with certain fixed sizes. | |||||||||||||||||
| |||||||||||||||||
▲ | ori_b 3 days ago | parent | prev | next [-] | ||||||||||||||||
Those effectively exist. They're called slices. | |||||||||||||||||
▲ | uecker 3 days ago | parent | prev [-] | ||||||||||||||||
You can also put them safely on the stack. The VLA is discussion is just irrational. |