[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-ocrad] Some compatibility issues
From: |
Elmar Plischke |
Subject: |
[Bug-ocrad] Some compatibility issues |
Date: |
Fri, 7 Oct 2005 10:48:41 +0200 |
Hello there!
I've just compiled ocrad under SUN/Solaris using the native compiler.
However, there are some minor issues to report:
configure/Makefile combo does not respect the CXX and CXXFLAGS environment
variables. Maybe it's time to use some autoconf-magic. A good start seems to be
http://sources.redhat.com/autobook/
So, after some manual Makefile hacking, I've found the following GNUisms
The lines
void ...error( const char * msg ) throw() __attribute__ ((noreturn));
in common.h, rectangle.cc and track.cc should be protected by an
#ifdef _GNUC__/#endif pair
In main.cc, note that <getopt.h>, getopt_long() are GNU, the standard lib
offers only an interface via
int getopt(int argc, char * const *argv, const char *opt-
string);
extern char *optarg;
extern int optind, opterr, optopt;
One more to go:
snprintf() seems to be part of C99, but (Sun) C++ has no wrapper for it.
I circumvented this problem by using a format string with a precision argument,
so that the string is truncated by sprintf. It now reads
in main.cc
void Ocrad::internal_error( const char * msg ) throw()
{
char buf[80];
#ifdef __GNUC__
std::snprintf( buf, sizeof( buf ), "internal error: %s.\n", msg );
#else
std:sprintf( buf, "internal error: %.60s.\n", msg );
#endif
show_error( buf );
exit( 3 );
}
Best regards,
Elmar Plischke
- [Bug-ocrad] Some compatibility issues,
Elmar Plischke <=