On Tuesday, 10 October 2017 at 08:26:37 UTC, Marc Schütz wrote:
On Tuesday, 10 October 2017 at 02:58:45 UTC, Mr. Jonse wrote:
I need to store a hetrogeneous array of delegates. How can I
do this but still call the function with the appropriate
number of parameters at run time?
I have the
On Tuesday, 10 October 2017 at 02:58:45 UTC, Mr. Jonse wrote:
I need to store a hetrogeneous array of delegates. How can I do
this but still call the function with the appropriate number of
parameters at run time?
I have the parameters as Variant[] params and a
function/delegate
On Tuesday, 10 October 2017 at 02:58:45 UTC, Mr. Jonse wrote:
I need to store a hetrogeneous array of delegates. How can I do
this but still call the function with the appropriate number of
parameters at run time?
I have the parameters as Variant[] params and a
function/delegate
I need to store a hetrogeneous array of delegates. How can I do
this but still call the function with the appropriate number of
parameters at run time?
I have the parameters as Variant[] params and a function/delegate
pointer(void* for now).
Normally I'd push the parameters on the stack and
On 09/04/2017 7:30 AM, Jethro wrote:
void foo(A...)(A a)
{
foreach(aa; a)
{
for(int i = 0; i < a.length; i++)
...
}
}
A can be strings or char, how can I easily deal with both? (e.g.,
a.length = 1 for a being a char... and also a[0] = a, so to speak).
That is, I
void foo(A...)(A a)
{
foreach(aa; a)
{
for(int i = 0; i < a.length; i++)
...
}
}
A can be strings or char, how can I easily deal with both? (e.g.,
a.length = 1 for a being a char... and also a[0] = a, so to
speak).
That is, I want chars to be treated as
On Friday, 5 August 2016 at 08:32:42 UTC, kink wrote:
On Thursday, 4 August 2016 at 21:03:52 UTC, Mark "J" Twain
wrote:
How can I construct a va_list for vsprintf when all I have is
the a list of pointers to the data, without their type info?
A va_list seems to be a packed struct of values
On Friday, 5 August 2016 at 19:21:38 UTC, Mark "J" Twain wrote:
On Friday, 5 August 2016 at 08:32:42 UTC, kink wrote:
On Thursday, 4 August 2016 at 21:03:52 UTC, Mark "J" Twain
[...]
This has absolutely nothing to do with D as these are C
functions, so you'd be better off asking this in
On Friday, 5 August 2016 at 08:32:42 UTC, kink wrote:
On Thursday, 4 August 2016 at 21:03:52 UTC, Mark "J" Twain [...]
This has absolutely nothing to do with D as these are C
functions, so you'd be better off asking this in another forum.
Um, then I wonder why I am using D? Why does D even
On Thursday, 4 August 2016 at 21:03:52 UTC, Mark "J" Twain wrote:
How can I construct a va_list for vsprintf when all I have is
the a list of pointers to the data, without their type info?
A va_list seems to be a packed struct of values and/or pointers
to the data. While I could construct
On Thursday, 4 August 2016 at 21:03:52 UTC, Mark "J" Twain wrote:
How can I construct a va_list for vsprintf when all I have is
the a list of pointers to the data, without their type info?
A va_list seems to be a packed struct of values and/or pointers
to the data. While I could construct
How can I construct a va_list for vsprintf when all I have is the
a list of pointers to the data, without their type info?
A va_list seems to be a packed struct of values and/or pointers
to the data. While I could construct such a list, theoretically,
I don't always know when I should store
On Saturday, 16 November 2013 at 23:55:47 UTC, Jonathan M Davis
wrote:
If you're dealing with variadic arguments, then making the file
and line number
be template arguments is really your only solution. However, I
must warn you
that that will result in a new template instantation _every_
What are the chances of the middle-man function being inlined,
thus cutting down on template bloat in the final product? I
should hope it would be practically guaranteed.
Even full inlining can't and won't do anything about template
bloat within D semantics. This approach will, however,
On Sunday, November 17, 2013 13:06:11 Chris Nicholson-Sauls wrote:
Something I'm wondering: if one were to split the implementation
along these lines:
void error (string file = __FILE__, size_t line = __LINE__,
Args...) (string msg, Args args) {
errorImpl(file, line, msg, args);
}
17-Nov-2013 16:36, Jonathan M Davis пишет:
On Sunday, November 17, 2013 13:06:11 Chris Nicholson-Sauls wrote:
Something I'm wondering: if one were to split the implementation
along these lines:
void error (string file = __FILE__, size_t line = __LINE__,
Args...) (string msg, Args args) {
On Sunday, November 17, 2013 16:49:11 Dmitry Olshansky wrote:
At least we should fix this embarrassing limitation that kills inlining
of std.ascii on ALL compilers.
https://d.puremagic.com/issues/show_bug.cgi?id=10985
And it's not only std.ascii pretty much all non-templated stuff.
Yeah,
On Saturday, 16 November 2013 at 23:55:47 UTC, Jonathan M Davis
wrote:
[...]
e.g. force the
caller to call format when creating the message rather than
supporting
variadic arguments directly in error.
- Jonathan M Davis
OK, how about this implementation?
string msg( S : string, T... )( S
On Sunday, November 17, 2013 20:11:20 Rob T wrote:
On Saturday, 16 November 2013 at 23:55:47 UTC, Jonathan M Davis
wrote:
[...]
e.g. force the
caller to call format when creating the message rather than
supporting
variadic arguments directly in error.
- Jonathan M Davis
OK,
Good points, got it down to this.
void error(string a_Msg, string file = __FILE__, size_t line =
__LINE__)
{
writefln( a_Msg ~ . In file %s on line %d., file, line );
}
int main()
{
format(hallo).error;
format(Hallo %s., du da).error;
}
There should be no more template bloat, and it
On Sunday, November 17, 2013 22:08:38 Rob T wrote:
Good points, got it down to this.
void error(string a_Msg, string file = __FILE__, size_t line =
__LINE__)
{
writefln( a_Msg ~ . In file %s on line %d., file, line );
}
int main()
{
format(hallo).error;
format(Hallo %s.,
On Sunday, 17 November 2013 at 21:29:03 UTC, Jonathan M Davis
wrote:
Yeah. Don't use concatenation in your format string:
Right, that concat was bothering me too. Tks for the input.
--rt
Hi.
Is it possible to write something like that?
void error(Args...)(string msg, Args args, string file =
__FILE__, size_t line = __LINE__) { ... }
?
Currently not, but how could it be done? I wont like to write:
error(format(msg, args));
Thanks in advance. :)
On Saturday, 16 November 2013 at 22:57:35 UTC, Namespace wrote:
Hi.
Is it possible to write something like that?
void error(Args...)(string msg, Args args, string file =
__FILE__, size_t line = __LINE__) { ... }
?
Currently not, but how could it be done? I wont like to write:
On Sunday, November 17, 2013 00:09:53 Namespace wrote:
On Saturday, 16 November 2013 at 22:57:35 UTC, Namespace wrote:
Hi.
Is it possible to write something like that?
void error(Args...)(string msg, Args args, string file =
__FILE__, size_t line = __LINE__) { ... }
?
Namespace:
It is always surprising how quickly one has found its own
solution, after you have posted here... :)
This is a well known psychological phenomenon: when you explain
your problem to other people you lay down the problem very well,
its constraints, its invariants, your needs, and
unfortunately this problem keeps arising every so often and the only thing
we have are workarounds
to name a few:
digitalmars.D - Typesafe variadics in any position
feature request: special optional argument (__FILE__, ...) AFTER variadic
template
On Sat, Nov 16, 2013 at 3:55 PM, Jonathan M
The following fails because the compiler assumes I am trying to
dereference non-pointer variables. Can this be done?
void main()
{
int i;
int* pi;
double d;
double* pd;
char c;
char* pc;
scan(i, pi, d, pd, c, pc);
}
void scan(A...)(ref A data)
{
import
On 29-Oct-12 00:36, Tyro[17] wrote:
The following fails because the compiler assumes I am trying to
dereference non-pointer variables. Can this be done?
void main()
{
int i;
int* pi;
double d;
double* pd;
char c;
char* pc;
scan(i, pi, d, pd, c, pc);
}
void
On 10/28/12 4:44 PM, Dmitry Olshansky wrote:
On 29-Oct-12 00:36, Tyro[17] wrote:
The following fails because the compiler assumes I am trying to
dereference non-pointer variables. Can this be done?
void main()
{
int i;
int* pi;
double d;
double* pd;
char c;
char*
On 2012-08-28 22:10, Tyro[17] nos...@home.com wrote:
On 10/28/12 4:44 PM, Dmitry Olshansky wrote:
On 29-Oct-12 00:36, Tyro[17] wrote:
The following fails because the compiler assumes I am trying to
dereference non-pointer variables. Can this be done?
void main()
{
int i;
int* pi;
On 10/28/12 5:16 PM, Simen Kjaeraas wrote:
On 2012-08-28 22:10, Tyro[17] nos...@home.com wrote:
On 10/28/12 4:44 PM, Dmitry Olshansky wrote:
On 29-Oct-12 00:36, Tyro[17] wrote:
The following fails because the compiler assumes I am trying to
dereference non-pointer variables. Can this be
32 matches
Mail list logo