public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A new patch for libstdc++
@ 1997-10-10 17:21 H.J. Lu
  1997-10-10 22:46 ` Alexandre Oliva
  1997-10-11 12:29 ` Joe Buck
  0 siblings, 2 replies; 3+ messages in thread
From: H.J. Lu @ 1997-10-10 17:21 UTC (permalink / raw)
  To: egcs

Hi,

It turned out the OUTOFRANGE bug is triggered by a typo. But you
still cannot throw out_of_range in string. Here is a new patch.


-- 
H.J. Lu (hjl@gnu.ai.mit.edu)
---
Fri Oct 10 12:15:51 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)

	* std/bastring.h (OUTOFRANGE): Use assert () for string.
	Fix typo for others.

Mon Aug 25 17:31:49 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)

	* Makefile.in ($(SHLIB)): Use $(CC) instead of (CXX) to avoid
	implicit -lstdc++.

Index: libstdc++/Makefile.in
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libstdc++/Makefile.in,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Makefile.in
--- Makefile.in	1997/08/29 00:32:44	1.1.1.2
+++ Makefile.in	1997/09/08 21:02:08
@@ -87,7 +87,7 @@
 	$(RANLIB) $(ARLIB)
 
 $(SHLIB): piclist
-	$(CXX) $(LIBCXXFLAGS) $(SHFLAGS) -shared -o $(SHLIB) `cat piclist` $(SHDEPS)
+	$(CC) $(LIBCXXFLAGS) $(SHFLAGS) -shared -o $(SHLIB) `cat piclist` $(SHDEPS)
 
 $(SHARLIB): $(SHLIB)
 	-rm -f t$(SHARLIB)
Index: libstdc++/std/bastring.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libstdc++/std/bastring.h,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 bastring.h
--- bastring.h	1997/10/09 17:31:45	1.1.1.5
+++ bastring.h	1997/10/10 19:14:56
@@ -33,6 +33,7 @@
 #endif
 
 #include <cstddef>
+#include <typeinfo>
 #include <std/straits.h>
 
 extern "C++" {
@@ -365,10 +366,18 @@
 #ifdef __STL_USE_EXCEPTIONS
 
 #include <stdexcept>
-#define OUTOFRANGE(cond) \
-  do { if (!(cond)) throw out_of_range (#cond); } while (0)
-#define LENGTHERROR(cond) \
-  do { if (!(cond)) throw length_error (#cond); } while (0)
+#include <cassert>
+
+#define OUTOFRANGE(cond)					\
+  if (typeid (value_type) == typeid (char))			\
+    assert (!(cond));						\
+  else								\
+    do { if ((cond)) throw out_of_range (#cond); } while (0)
+#define LENGTHERROR(cond)					\
+  if (typeid (value_type) == typeid (char))			\
+    assert (!(cond));						\
+  else								\
+    do { if ((cond)) throw length_error (#cond); } while (0)
 
 #else
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A new patch for libstdc++
  1997-10-10 17:21 A new patch for libstdc++ H.J. Lu
@ 1997-10-10 22:46 ` Alexandre Oliva
  1997-10-11 12:29 ` Joe Buck
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 1997-10-10 22:46 UTC (permalink / raw)
  To: H.J. Lu; +Cc: egcs

H J Lu writes:

> But you still cannot throw out_of_range in string. 

Why not?

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A new patch for libstdc++
  1997-10-10 17:21 A new patch for libstdc++ H.J. Lu
  1997-10-10 22:46 ` Alexandre Oliva
@ 1997-10-11 12:29 ` Joe Buck
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Buck @ 1997-10-11 12:29 UTC (permalink / raw)
  To: H.J. Lu; +Cc: egcs

> It turned out the OUTOFRANGE bug is triggered by a typo. But you
> still cannot throw out_of_range in string. Here is a new patch.

I still haven't seen any test case that backs up this assertion.
Yes, recursion may result (the constructor that is throwing will
call the identical constructor), but as best I can tell, the second
call can never throw, therefore there is no problem.  If you believe
otherwise, please post a case that causes an infinite recursion.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-10-11 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-10 17:21 A new patch for libstdc++ H.J. Lu
1997-10-10 22:46 ` Alexandre Oliva
1997-10-11 12:29 ` Joe Buck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).