Re: __FILE__ and __LINE__ again...

2013-09-12 Thread Dicebot
On Tuesday, 10 September 2013 at 16:58:54 UTC, H. S. Teoh wrote: On Tue, Sep 10, 2013 at 06:50:03PM +0200, Dicebot wrote: On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: but you can get rid of this with link-time optimization (on Posix, you'd add -L-gc-sections to your dmd

Re: __FILE__ and __LINE__ again...

2013-09-12 Thread H. S. Teoh
On Thu, Sep 12, 2013 at 03:37:58PM +0200, Dicebot wrote: On Tuesday, 10 September 2013 at 16:58:54 UTC, H. S. Teoh wrote: On Tue, Sep 10, 2013 at 06:50:03PM +0200, Dicebot wrote: On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: but you can get rid of this with link-time

Re: __FILE__ and __LINE__ again...

2013-09-12 Thread Dicebot
On Thursday, 12 September 2013 at 13:58:03 UTC, H. S. Teoh wrote: Interesting. However, I ran into some runtime segfaults caused by --gc-sections yesterday. I didn't investigate further, but that makes me hesitant to make --gc-sections the default. Something, somewhere, is being broken by

__FILE__ and __LINE__ again...

2013-09-10 Thread Paolo Invernizzi
Johannes Pfau wrote something like this, in the logger thread: If you write code like this: void log(string file = __FILE__)() //A template { logImpl(file); } void logImpl(string file){} //Not a template The compiler can always inline the log template. So there's no template bloat as there

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread Dicebot
On Tuesday, 10 September 2013 at 16:00:55 UTC, Paolo Invernizzi wrote: Johannes Pfau wrote something like this, in the logger thread: If you write code like this: void log(string file = __FILE__)() //A template { logImpl(file); } void logImpl(string file){} //Not a template The compiler can

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread Dicebot
On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: but you can get rid of this with link-time optimization (on Posix, you'd add -L-gc-sections to your dmd command-line: this will cause ld to delete code sections that are never referenced, which includes the log() instantiations if

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread H. S. Teoh
On Tue, Sep 10, 2013 at 06:50:03PM +0200, Dicebot wrote: On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: but you can get rid of this with link-time optimization (on Posix, you'd add -L-gc-sections to your dmd command-line: this will cause ld to delete code sections that are

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread H. S. Teoh
On Tue, Sep 10, 2013 at 06:00:53PM +0200, Paolo Invernizzi wrote: Johannes Pfau wrote something like this, in the logger thread: If you write code like this: void log(string file = __FILE__)() //A template { logImpl(file); } void logImpl(string file){} //Not a template The compiler

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread Dicebot
On Tuesday, 10 September 2013 at 16:58:54 UTC, H. S. Teoh wrote: On Tue, Sep 10, 2013 at 06:50:03PM +0200, Dicebot wrote: On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: but you can get rid of this with link-time optimization (on Posix, you'd add -L-gc-sections to your dmd

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread Paolo Invernizzi
On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: On Tue, Sep 10, 2013 at 06:00:53PM +0200, Paolo Invernizzi wrote: Johannes Pfau wrote something like this, in the logger thread: If you write code like this: void log(string file = __FILE__)() //A template { logImpl(file); }