This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: verbose terminate() on by default

Phil Edwards <> writes:

| Replacing it with write() would be a bad step, I think.  Now we have
| multiple system calls, instead of a single one done after formatting.

I disagree that this will be a bad steo for the reasons you gave.

  (1)  How many system calls are there?
  (2)  We're not on the critical path.

| +#define errwrite(s)  write(2,s,strlen(s))

Is there any reason why this isn't an inline function?

namespace __gnu_cxx
    inline void
    write_message(const char* msg)
       write(2, msg, strlen(msg));

| +
|  namespace __gnu_cxx
|  {
|    /* A replacement for the standard terminate_handler which prints
| @@ -57,8 +59,12 @@
|  	  dem = __cxa_demangle(name, 0, 0, &status);
| -	  fprintf(stderr, "terminate called after throwing a `%s'\n", 
| -		  status == 0 ? dem : name);
| +	  errwrite("terminate called after throwing a `");
          write_message("std::terminate called after uncaught expection '");

If we're going to be verbose, then please let's be explanatory.  Also,
it was agreed at some point that "`...'" is bad quoting.

-- Gaby

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]