On Sunday, 25 June 2017 at 22:53:07 UTC, Johan Engelen wrote:
I meant semantically no call.
In the existing language, I think version (or static if) at the
usage and definition points both is as good as you're going to
get.
unless you use a preprocessor lol
But the good news about version
On Sunday, 25 June 2017 at 22:23:44 UTC, Moritz Maxeiner wrote:
The solution obviously does *not* work if you change the
premise of your question after the fact by artificially
injecting instructions into all function bodies
I meant semantically no call. I am asking for a little more
On Sunday, 25 June 2017 at 21:55:22 UTC, Johan Engelen wrote:
On Sunday, 25 June 2017 at 16:31:52 UTC, Moritz Maxeiner wrote:
By requiring the compiler to inline the empty foo:
This won't work.
Yes, it does; comment out the call to `foo` and notice no change
in the assembly in my link.
On Sunday, 25 June 2017 at 16:31:52 UTC, Moritz Maxeiner wrote:
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote:
[...]
If version(X) is not defined, there should be no call and no
extra code at -O0.
[...]
In C, you could do something like:
```
#if X
void foo() {..}
#else
On Sunday, 25 June 2017 at 16:29:20 UTC, Anonymouse wrote:
Am I missing something, or can't you just version both the
function and the function ćall?
version(X)
void foo() { /* ... */ }
void main()
{
version(X)
{
foo();
}
}
I am hoping for something where "foo()" would
On Sunday, 25 June 2017 at 13:32:57 UTC, Andrew Chapman wrote:
I think you've answered the question with "You cannot have
unimplemented templates in interfaces". Thanks for the answer.
I'll rethink the way I'm doing this.
Cheers.
In your case you can probably use something along the lines
On Sunday, 25 June 2017 at 13:32:57 UTC, Andrew Chapman wrote:
I think you've answered the question with "You cannot have
unimplemented templates in interfaces". Thanks for the answer.
I'll rethink the way I'm doing this.
Cheers.
Yes, function templates in classes or interfaces are
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote:
[...]
If version(X) is not defined, there should be no call and no
extra code at -O0.
[...]
In C, you could do something like:
```
#if X
void foo() {..}
#else
#define foo()
#endif
```
How would you do this in D?
By
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote:
How would you solve this problem: do an optional function call
depending on some version(X). If version(X) is not defined,
there should be no call and no extra code at -O0.
```
{
...
foo(); // either compiles to a function
How would you solve this problem: do an optional function call
depending on some version(X). If version(X) is not defined, there
should be no call and no extra code at -O0.
```
{
...
foo(); // either compiles to a function call, or to _nothing_.
...
}
```
In C, you could do something
On Sunday, 25 June 2017 at 02:09:53 UTC, Adam D. Ruppe wrote:
On Sunday, 25 June 2017 at 02:05:35 UTC, unleashy wrote:
How would I call `addToBar` from C code?
You don't. Instead write it like:
struct Foo
{
int bar;
}
extern(C) void addToBar(Foo* foo, int what) {
foo.bar += what;
I think you've answered the question with "You cannot have
unimplemented templates in interfaces". Thanks for the answer.
I'll rethink the way I'm doing this.
Cheers.
On Sunday, 25 June 2017 at 13:04:32 UTC, Nicholas Wilson wrote:
On Sunday, 25 June 2017 at 11:39:27 UTC, Andrew Chapman wrote:
Hi guys, I'm a little confused as to whether D supports
interfaces with templates. I can compile OK, but linking
reports an error like this:
Error 42: Symbol
On Sunday, 25 June 2017 at 11:39:27 UTC, Andrew Chapman wrote:
Hi guys, I'm a little confused as to whether D supports
interfaces with templates. I can compile OK, but linking
reports an error like this:
Error 42: Symbol Undefined
Hi guys,
here's my full code below.
My problem is that last "auto Y = X" assignment, that the
compiler won't accept:
yo.globalFunction.DirectStruct.IndirectStruct.indirectMemberFunc
cannot access frame of function yo.globalFunction
I was expecting X to be accessible from here.
Suprisingly,
Hi guys, I'm a little confused as to whether D supports
interfaces with templates. I can compile OK, but linking reports
an error like this:
Error 42: Symbol Undefined
_D12relationaldb10interfaces21RÇëÜDBIÇêÿ35__T7loadRowTS6prefix÷6P¶ZÇêáMFAyaAS3std7variant18Çâ└8VÇåìNVki20ZÇëÅZÇûð
16 matches
Mail list logo