I see.
Then there isn't really a way to do this as the 'sz' in @[a?][sz]
is static.
I will keep an eye on it. Maybe I can find a way to support it in ATS3.
On Tuesday, September 25, 2018 at 7:01:48 PM UTC-4, M88 wrote:
>
>
> I get an error during C compilation, ATSERRORarrdim_unknown, when I try to
> use a template function.
>
> Thanks Julian -- that's a decent solution.
>
>
> On Tuesday, September 25, 2018 at 3:28:05 PM UTC-4, M88 wrote:
>>
>> Hello,
>>
>> I was wondering if it's possible to use a template to define the size of
>> a statically allocated array in a template.
>>
>> An example (that won't compile) is:
>>
>> extern
>> fun {a:t@ype} example () : void
>>
>> extern
>> val {} example$bufsz : [n:pos] size_t n
>>
>> implement {a}
>> example () =
>> let
>> val sz = example$bufsz<>
>> var buf = @[a?][sz]()
>> in
>> end
>>
>> Is it possible to define example$bufsz<> as a constant with
>> late-binding? I suppose behavior like sizeof<a> would be ideal, but that
>> seems to be internal.
>>
>> Thanks,
>> -M
>>
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/d5e8a526-7b11-42dd-87df-01c58b5a2ba5%40googlegroups.com.