This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Alternative to __FILE__/__LINE__
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Sun, 4 Mar 2018 21:55:06 +0100 (CET)
- Subject: Re: Alternative to __FILE__/__LINE__
- Authentication-results: sourceware.org; auth=none
- References: <d4a085d4-5676-6564-768b-59cac5bef2f7@gmail.com>
- Reply-to: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
On Sun, 4 Mar 2018, François Dumont wrote:
Debug mode is using __FILE__/__LINE__ to show where the assertion took
place. So assertion looks like this:
/home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/deque:175:
Error: function requires a valid iterator range [__first, __last).
But IMHO a smarter information would be to provide the file:line in the
source code that generated this assertion so that users could more easily go
to the faulty code.
How about printing a backtrace then? Though at some point the user might
want to start a debugger to get more information.
--
Marc Glisse