Mercurial > projects > dwt-linux
comparison dwt/internal/gtk/OS.d @ 325:68adc3a367d9
Better static asserts to detect changing .stringof format
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 07 Oct 2008 18:13:28 +0200 |
parents | 174bd206cf10 |
children | f1bb3949939b |
comparison
equal
deleted
inserted
replaced
324:174bd206cf10 | 325:68adc3a367d9 |
---|---|
614 | 614 |
615 | 615 |
616 template NameOfFunc(alias f) { | 616 template NameOfFunc(alias f) { |
617 // Note: highly dependent on the .stringof formatting | 617 // Note: highly dependent on the .stringof formatting |
618 // the value begins with "& " which is why the first two chars are cut off | 618 // the value begins with "& " which is why the first two chars are cut off |
619 | |
620 // this is also used in dwt/internal/cairo/Cairo and dwt/internal/accessible/gtk/ATK | |
619 version( LDC ){ | 621 version( LDC ){ |
620 // stringof in LLVMDC is "&foobar" | 622 // stringof in LDC is "&foobar" |
623 static assert( (&f).stringof[0] == '&' ); | |
624 static assert( (&f).stringof[1] != ' ' ); | |
621 const char[] NameOfFunc = (&f).stringof[1 .. $]; | 625 const char[] NameOfFunc = (&f).stringof[1 .. $]; |
622 } | 626 } |
623 else{ | 627 else{ |
624 // stringof in DMD is "& foobar" | 628 // stringof in DMD is "& foobar" |
629 static assert( (&f).stringof[0] == '&' ); | |
630 static assert( (&f).stringof[1] == ' ' ); | |
625 const char[] NameOfFunc = (&f).stringof[2 .. $]; | 631 const char[] NameOfFunc = (&f).stringof[2 .. $]; |
626 } | 632 } |
627 } | 633 } |
628 | 634 |
629 template ForwardGtkOsCFunc( alias cFunc ) { | 635 template ForwardGtkOsCFunc( alias cFunc ) { |