On Friday, 10 August 2018 at 11:10:55 UTC, learnfirst1 wrote:
Still, if my first example is use GC, why dmd not throw error
at compile time, instead at link time report symbols is
missing. Is this a bug ?
If you make your main function @nogc, you will get a compile-time
error.
On Friday, 10 August 2018 at 10:38:53 UTC, Simen Kjærås wrote:
What you should do instead is:
T!((t){
printf("test 2 name = %s\n".ptr, t.name.ptr);
}, "test");
(note the lack of the => arrow)
--
Simen
rikki cattermole , Paul Backus, Simen Kjærås: thanks for the
exp
On Friday, 10 August 2018 at 09:57:53 UTC, learnfirst1 wrote:
T!(t => {
printf("test 2 name = %s\n".ptr, t.name.ptr);
}, "test") ; // build error
This is not doing what you think it's doing. The syntax t => {
return t; } is equivalent to t => () => t. That is, i
On Friday, 10 August 2018 at 09:57:53 UTC, learnfirst1 wrote:
import core.stdc.stdio;
struct Test {
string name ;
}
void T(alias pred, A...)(){
__gshared t = Test(A) ;
pred(t);
}
extern(C) void main(){
T!(t => printf("test 1 name = %s\n".ptr, t.name.ptr), "test")
;
On 10/08/2018 9:57 PM, learnfirst1 wrote:
import core.stdc.stdio;
struct Test {
string name ;
}
void T(alias pred, A...)(){
__gshared t = Test(A) ;
pred(t);
}
extern(C) void main(){
T!(t => printf("test 1 name = %s\n".ptr, t.name.ptr), "test") ; //
build OK
T!(t =>