plans for macros
gaboonviper at gmx.net
Thu May 15 11:39:21 PDT 2008
What about just adding an if statement-within this kind of template?
Wouldn't that suffice?
Using the ',' instead of concatenation can prevent a lot of complicated
string functions. The only difference between that and macro's would be
the function call and putting the objects on the stack. Basically the only
advantage of macros would be that the function call is inlined.
On Thu, 15 May 2008 19:57:55 +0200, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
> Yes, but turning on debug levels is a compile-time thing. Many times,
> want to log based on a run-time decision, i.e. a command line switch.
> Your solution does not work in this case.
> "boyd" wrote
> I use nearly that exact syntax in my project:
> debug Log(5, "blar", 10.0f);
> The Log function is built using a simple template:
> void Log(T...)(T t)
> As far as syntax goes that's in my opinion pretty nice. And the function
> isn't even called if debug is off. You can easily adapt it to work with
> debug levels:
> So, this is in my opinion a problem that doesn't really need macro's to
> solve it.
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the Digitalmars-d-learn