expanding variadic into format
rikki cattermole
rikki at cattermole.co.nz
Wed Oct 31 12:11:45 UTC 2018
On 01/11/2018 1:08 AM, Codifies wrote:
> On Wednesday, 31 October 2018 at 11:56:31 UTC, rikki cattermole wrote:
>> On 01/11/2018 12:53 AM, Codifies wrote:
>>> [...]
>>
>> Just to confirm, format there is std.format:format right?
>>
>> Because that isn't using C variadics, its using template variadics.
>
> thought I was using core.vararg and std.format both using templates ??
No. They use different variadics.
Template variadics happen on the template parameter side:
void func(T...)(T args) {
pragma(msg, T.length);
pragma(msg, T.stringof);
}
C variadics happen on the function parameters side and are highly unsafe:
void func(...) {
}
If you use core.vararg you're talking with C.
If you use std.format you're talking D's template variadics.
More information about the Digitalmars-d-learn
mailing list