Trouble creating a formatted assert wrapper

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Sep 4 02:43:22 PDT 2012


On Tuesday, 4 September 2012 at 09:24:26 UTC, Don Clugston wrote:
> On 03/09/12 23:48, Chris Nicholson-Sauls wrote:
>> I reiterate my impression that magical __FILE__ and
>> __LINE__ should be provided by some other means.
>
> It was a special-case hack to fix a special-case need. It was 
> extremely easy to implement (about 2 hours work) and has been 
> very successful in fixing that need. Everything else that 
> anyone has talked about is at least ten times as complicated, 
> and doesn't seem to offer significant advantages.
>
> It's really easy to come up with over-engineered solutions to 
> these sorts of things.

How difficult would hidden params, triggered by usage, be?  Ie: 
my function makes use of __CALL_FILE and __CALL_LINE variables by 
name, therefore they are tacked on  (as const, presumably) and 
always passed, thanks to diabolic compiler sorcery.  The current 
solution is fine in a majority of cases, at least so far, but 
there are going to be moments like what the OP had, and these 
moments are discouraging especially to newcomers.

I won't pretend to know if it would be easy or not; you're a heck 
of a lot more familiar with the compiler's code than I am.  But 
it certainly seems straightforward.


More information about the Digitalmars-d mailing list