Thread overview | |||||
---|---|---|---|---|---|
|
February 04, 2002 strict varargs | ||||
---|---|---|---|---|
| ||||
How about a syntax to define a function that takes an unlimited number of arguments of _one_, strictly defined type? Something like this: void printfi(int count, int...); // takes unlimited number of ints void printfs(int count, char[]...); // takes unlimited number of strings |
February 04, 2002 Re: strict varargs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | That would not be far from simply taking a dynamic array of those types. That can already be done; question is, it it worth having the compiler do it for you? Pavel Minayev wrote: > How about a syntax to define a function that takes an unlimited number of arguments of _one_, strictly defined type? Something like this: > > void printfi(int count, int...); // takes unlimited number of ints > void printfs(int count, char[]...); // takes unlimited number of strings -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ] |
February 04, 2002 Re: strict varargs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3C5EFE95.E9A3B0DB@deming-os.org... > That would not be far from simply taking a dynamic array of those types. That > can already be done; question is, it it worth having the compiler do it for you? If we have array literals, no. It'd look like this, then: printfi([1, 2, 3]); But we don't have them and we don't know if they'll be there or not. |
Copyright © 1999-2021 by the D Language Foundation