Is there a way to bypass the file and line into D assert function ?
Max Haughton
maxhaton at gmail.com
Fri Jul 19 20:16:54 UTC 2019
On Friday, 19 July 2019 at 15:30:25 UTC, Newbie2019 wrote:
> for example:
>
> void ASSERT(string fmt, string file = __FILE_FULL_PATH__,
> size_t line = __LINE__, T...) (bool c, scope T a) @nogc {
> assert(c, string, file, line);
> }
>
> but i get this error:
>
> error.d(39): Error: found file when expecting )
> error.d(39): Error: found ) when expecting ; following statement
> error.d(39): Deprecation: use { } for an empty statement, not ;
>
> I want d to print the error message with some format
> information, and show the right file and line for the original
> location.
>
> Is it doable ?
Isn't assert a template (file and line) rather than a plain
function call?
Worst comes to worst, you can provide your own _d_assert(?) and
override object.d then just call the C assert
More information about the Digitalmars-d-learn
mailing list