An example:
a.d:
```
import core.stdc.stdio;
void foo()() {
version (Oops)
printf(" foo - oops\n");
else
printf(" foo\n");
}
void doA() {
printf("doA:\n");
foo!();
}
```
b.d:
```
import core.stdc.stdio;
import a;
void main() {
printf("main:\n");
foo!(
On Thursday, 27 January 2022 at 18:12:18 UTC, Johan Engelen wrote:
But the language requires ODR, so we can emit templates as
weak_odr, telling the optimizer and linker that the symbols
should be merged _and_ that ODR can be assumed to hold (i.e.
inlining is OK).
Thanks! This was also my impr
On Thursday, 9 December 2021 at 21:06:54 UTC, Siarhei Siamashka
wrote:
On Thursday, 9 December 2021 at 20:53:52 UTC, Siarhei Siamashka
wrote:
How would one construct a simple example of a template
symbol getting successfully overridden by a global symbol?
Forgot to mention that a template fu
On Thu, Jan 27, 2022 at 05:42:09PM +, WhatMeWorry via Digitalmars-d-learn
wrote:
> While studying Ali's book at chapter "Constructor and Other Special
> Functions" and the below code snippet:
[...]
> // Original
> //this(int i) const { writeln("a const object"); }
> //t
On Thursday, 27 January 2022 at 16:46:59 UTC, Ali Çehreli wrote:
What I know is that weak symbols can be overridden by strong
symbols during linking. Which means, if a function body is
inlined which also has a weak symbol, some part of the program
may be using the inlined definition and some
On 1/27/22 12:42 PM, WhatMeWorry wrote:
Assuming I can speak in correct programmer-ese: I was wondering why the
qualifiers were placed after the function parameter list (int i). Just
for fun, I moved to type qualifiers before the function definitions
"this" (like a return type?) and the outpu
On Thursday, 27 January 2022 at 17:42:09 UTC, WhatMeWorry wrote:
So I guess my question is, is this just a matter of esthetics
or is some more nuanced goal at work here?
It doesn't matter much for constructors, but in general, the
problem with placing qualifiers in front is that it looks
conf
While studying Ali's book at chapter "Constructor and Other
Special Functions" and the below code snippet:
import std.stdio;
struct S {
this(int i) { writeln("an object"); }
// Original
//this(int i) const { writeln("a const object"); }
//this(int i) immuta
On Thu, Jan 27, 2022 at 08:46:59AM -0800, Ali Çehreli via Digitalmars-d-learn
wrote:
[...]
> I see that template instantiations are linked through weak symbols:
>
> $ nm deneme | grep foo
> [...]
> 00021380 W _D6deneme__T3fooTiZQhFNaNbNiNfZv
>
> What I know is that weak symbols can be ov
On 1/26/22 11:07, Siarhei Siamashka wrote:
> On Wednesday, 26 January 2022 at 18:41:51 UTC, Iain Buclaw wrote:
>> The D language shot itself in the foot by requiring templates to have
>> weak semantics.
>>
>> If DMD and LDC inline weak functions, that's their bug.
>
> As I already mentioned in the
On 1/26/22 18:49, Andrey Zherikov wrote:
> I want something like this:
> ```d
> void foo(MODULES... = __MODULE__)() {}
Two other options:
1)
void foo(MODULES_...)() {
static if (MODULES_.length == 0) {
import std.meta : AliasSeq;
alias MODULES = AliasSeq!__MODULE__;
} else {
a
On 1/27/22 10:21 AM, Andrey Zherikov wrote:
So is it possible to get rid of the alias?
I'm not sure it's worth the effort? Yours is a pretty straightforward
solution.
-Steve
On Thursday, 27 January 2022 at 03:19:59 UTC, Jaime wrote:
You can accomplish this by heading off the template sequence
parameter with several default template parameters. If you need
them all under one name, you can recombine them in the function
body with std.meta.AliasSeq, the effective "kin
On 1/27/22 8:13 AM, Steven Schveighoffer wrote:
On Thursday, 27 January 2022 at 12:45:20 UTC, frame wrote:
Is the order of fields guaranteed returned by `.tupleof` and
`__traits(getMember,...)`, can I rely on this? I know that are
different things, I mean just per each use case if I have more
On Thursday, 27 January 2022 at 12:45:20 UTC, frame wrote:
Is the order of fields guaranteed returned by `.tupleof` and
`__traits(getMember,...)`, can I rely on this? I know that are
different things, I mean just per each use case if I have more
functions that traverses through all fields. Thx.
Is the order of fields guaranteed returned by `.tupleof` and
`__traits(getMember,...)`, can I rely on this? I know that are
different things, I mean just per each use case if I have more
functions that traverses through all fields. Thx.
16 matches
Mail list logo