# HG changeset patch # User jwe # Date 1021680308 0 # Node ID 818f5aec1db59aefeff5f6ad7c8dbdc62624a0bd # Parent a10df4059532b4b572a8dbeed72c1fa6cc7499a9 [project @ 2002-05-18 00:05:08 by jwe] diff --git a/liboctave/Array.h b/liboctave/Array.h --- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -254,7 +254,7 @@ #endif - static T resize_fill_value (void) { return static_cast (0); } + static T resize_fill_value (void) { return T (); } void print_info (std::ostream& os, const std::string& prefix) const; }; diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2002-05-17 Mumit Khan + + * Array.h (Array::resize_fill_value): Return default initialized + object. + 2002-05-14 John W. Eaton * oct-rl-edit.c (OCTAVE_RL_SAVE_STRING): New macro. diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2002-05-17 Mumit Khan + + * c-file-ptr-stream.h (OCTAVE_STD_FILEBUF): New macro to handle + various forms of extensions to std::filebuf. + (c_file_ptr_buf::c_file_ptr_buf): Use. + * pt-idx.cc (tree_index_expression::tree_index_expression): Remove + default arguments are from definition. + * symtab.cc (SYMBOL_DEF::print_info): Add std::. + (symbol_record::print_info): Likewise. + (symbol_table::print_info): Likewise. + 2002-05-16 John W. Eaton * oct-map.cc (Octave_map::assign): Resize RHS if it is shorter diff --git a/src/c-file-ptr-stream.h b/src/c-file-ptr-stream.h --- a/src/c-file-ptr-stream.h +++ b/src/c-file-ptr-stream.h @@ -31,13 +31,37 @@ #include #include +// +// The c_file_ptr_buf requires a std::filebuf that accepts an open +// file descriptor. This feature, while not part of the ISO C++ +// standard, is supported by a variety of C++ compiler runtimes, +// albeit in slightly different ways. +// +// The C++ runtime libraries shipped with GCC versions < 3.0, Sun Pro, +// Sun Workshop/Forte 5/6, Compaq C++ all support a non-standard filebuf +// constructor that takes an open file descriptor. The almost ISO compliant +// GNU C++ runtime shipped with GCC 3.0.x supports a different non-standard +// filebuf constructor that takes a FILE* instead; starting from GCC 3.1, +// the GNU C++ runtime removes all non-standard std::filebuf constructors +// and provides an extension template class __gnu_cxx::stdio_filebuf +// that supports the the 3.0.x behavior. +// +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +# include +# define OCTAVE_STD_FILEBUF __gnu_cxx::stdio_filebuf +#else +# define OCTAVE_STD_FILEBUF std::filebuf +#endif + class -c_file_ptr_buf : public std::filebuf +c_file_ptr_buf : public OCTAVE_STD_FILEBUF { public: #if !defined (CXX_ISO_COMPLIANT_LIBRARY) typedef int int_type; +#else + typedef std::filebuf::int_type int_type; #endif typedef int (*close_fcn) (FILE *); @@ -47,9 +71,9 @@ c_file_ptr_buf (FILE *f_arg, close_fcn cf_arg = ::fclose) : #if defined __GNUC__ && __GNUC__ >= 3 - std::filebuf (f_arg, std::ios::in | std::ios::out), + OCTAVE_STD_FILEBUF (f_arg, std::ios::in | std::ios::out), #else - std::filebuf (f_arg ? fileno (f_arg) : -1), + OCTAVE_STD_FILEBUF (f_arg ? fileno (f_arg) : -1), #endif f (f_arg), cf (cf_arg), fd (f_arg ? fileno (f_arg) : -1) @@ -94,6 +118,8 @@ int fd; }; +#undef OCTAVE_STD_FILEBUF + class i_c_file_ptr_stream : public std::istream { diff --git a/src/pt-idx.cc b/src/pt-idx.cc --- a/src/pt-idx.cc +++ b/src/pt-idx.cc @@ -59,7 +59,7 @@ tree_index_expression::tree_index_expression (tree_expression *e, const std::string& n, - int l = -1, int c = -1) + int l, int c) : tree_expression (l, c), expr (e), args (), type (), arg_nm () { append (n); diff --git a/src/symtab.cc b/src/symtab.cc --- a/src/symtab.cc +++ b/src/symtab.cc @@ -178,7 +178,7 @@ } void -SYMBOL_DEF::print_info (ostream& os, const std::string& prefix) const +SYMBOL_DEF::print_info (std::ostream& os, const std::string& prefix) const { os << prefix << "symbol_def::count: " << count << "\n"; @@ -476,7 +476,7 @@ } void -symbol_record::print_info (ostream& os, const std::string& prefix) const +symbol_record::print_info (std::ostream& os, const std::string& prefix) const { if (definition) definition->print_info (os, prefix); @@ -874,7 +874,7 @@ } void -symbol_table::print_info (ostream& os) const +symbol_table::print_info (std::ostream& os) const { int count = 0; int empty_chains = 0;