[OpenIndiana-discuss] Solaris C++ feof(): are we doing things differently?

Bryan N Iotti ironsides.medvet at runbox.com
Sun Oct 27 10:33:58 UTC 2013


Hi all,

got a little question for you that's been driving me crazy.

I'm trying to compile the FEBio finite element analysis software on OI hipster 151a8.

Studio 12.3 CC compilation is not working at all, with hundreds of errors, so for now I turned to g++.

g++ compiles fine with -g -m64 (I want the debug flags for now) and runs. However when I try to open a file from the verification suite it sends a SIGCABRT and terminates with "terminate called after throwing an instance of 'XMLReader::EndOfFile'
terminate called recursively".

I tracked it down in the code to the following function:

char XMLReader::GetChar()
{
	char ch;
	while ((ch=fgetc(m_fp))=='\n') ++m_nline;
	if (feof(m_fp)) throw EndOfFile();
	return ch;
}

m_fp is a file pointer. m_line is the current line, used as temp storage.
Setting a breakpoint at the feof() line allows the program to run until the end of the file, in which case it exits after trying to read past the end of the file (to my best guess and watching the gdb variables change).

Funny thing is, I have an old Enterprise 250 with a 400 Mhz UltraSPARC II and running Martin's OpenSXCE that runs it fine, no errors.

So I'd like to know:
- Are we supposed to use feof() differently from Linux?
- Are we using it differently on x86 and SPARC?
- Are we doing things differently from OpenSXCE?
- Any clues as to how I could rewrite the above in order for it to work?

Thank you all for any help you can provide on this matter.

   Bryan


-- 
Bryan N Iotti

+39 366 3708436
ironsides.medvet at runbox.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://openindiana.org/pipermail/openindiana-discuss/attachments/20131027/10c900e6/attachment.bin>


More information about the OpenIndiana-discuss mailing list