Stack-allocated arrays in ATS2 (or ATS3?)

57 views
Skip to first unread message

Vanessa McHale

unread,
Feb 23, 2019, 6:11:31 AM2/23/19
to ats-lan...@googlegroups.com
Is there any way to safely use alloca in ATS? I know the language has
features for both safe pointer arithmetic and safe use of
stack-allocated variables... so it would be nice to both guarantee no
out-of-bounds array accesses and no subsequent uses of the pointer.

Cheers,
Vanessa McHale



signature.asc

Artyom Shalkhakov

unread,
Feb 23, 2019, 6:24:24 AM2/23/19
to ats-lang-users
Hi Vanessa!
Have you seen this discussion:


As for me, I think It's OK to use the outlined approach. BTW it is already provided in the ATS2 libats/libc.
 
Cheers,
Vanessa McHale



gmhwxi

unread,
Mar 1, 2019, 11:38:55 PM3/1/19
to ats-lang-users

One very serious danger with using alloca is that alloca interferes with tail-call
optimization. After debugging code using alloca a couple times, I would be really
hard pressed to every use alloca again.
Reply all
Reply to author
Forward
0 new messages