load-save.cc oddity
David Bateman
David.Bateman at motorola.com
Mon Dec 10 08:35:43 CST 2007
Jack Howarth wrote:
> David,
> The section of code that is misbehaving on
> Apple's compilers is...
>
> #0 0x756f6d79 in ?? ()
> #1 0x01f1bf50 in std::basic_filebuf<char, std::char_traits<char> >::_M_terminate_output (this=0x8fe31ca4) at /sw/src/fink.build/gcc42-4.2.2-1000/darwin_objdir/i686-apple-darwin9/libstdc++-v3/include/fstream:712
> #2 0x8fe06e95 in __dyld__ZN4dyld14bindLazySymbolEPK11mach_headerPm ()
> #3 0x8fe18acf in __dyld_stub_binding_helper_interface2 ()
> #4 0x00bd4a83 in Fsave (args=@0x3806c98) at load-save.cc:1757
> #5 0x00df5ffd in octave_builtin::do_multi_index_op () at basic_ios.h:144
> #6 0x00df56f4 in octave_builtin::subsref () at basic_ios.h:144
> #7 0x00dc4a03 in octave_value::subsref () at basic_ios.h:144
> #8 0x00f0bfe4 in tree_index_expression::rvalue () at basic_ios.h:144
> #9 0x00f32a83 in tree_statement::eval () at basic_ios.h:144
> #10 0x00f330b4 in tree_statement_list::eval () at basic_ios.h:144
> #11 0x00d1c9b4 in main_loop () at basic_ios.h:144
> #12 0x00ca4726 in octave_main () at basic_ios.h:144
> #13 0x00001ff0 in main ()
> #14 0x00001f96 in start ()
>
> where line 1757 is at...
>
> {
> std::ofstream file (fname.c_str (), mode);
>
> if (file) <============= line 1757
> {
> bool write_header_info = ! file.tellp ();
>
> save_vars (argv, i, argc, file, format,
> save_as_floats, write_header_info);
>
> file.close ();
> }
> else
> {
> gripe_file_open ("save", fname);
> return retval;
> }
> }
> }
> }
>
>
> Any suggestions on how that could be rewritten?
>
Don't know how to work around the issue.. But why not at least try "if
(file.is_open ())", and if that doesn't work a try the "good", "bad",
"fail" and "eof" methods that might help working around the compiler bug
D.
--
David Bateman David.Bateman at motorola.com
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
More information about the Bug-octave
mailing list