[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
assert.h for OS X
From: |
rsina |
Subject: |
assert.h for OS X |
Date: |
Sat, 22 Oct 2005 19:53:21 GMT |
User-agent: |
KNode/0.9.0 |
Hi all,
I am using the assert function in my code and I have no problem compiling my
code under SuSe 9.3 linux (gcc 3.3.5). But when I try to port it to my imac
(Tiger, trying both with gcc 3.3 and 4.0) it balks.
One complain it has that in the following piece of code from the TNT linear
algebra package, assert does not have a template parameter, therefore it
has to be declared separately (no such complain for linux):
template <class T>
inline T& Array1D<T>::operator[](int i)
{
#ifdef TNT_BOUNDS_CHECK
assert(i>= 0);
assert(i < n_);
#endif
return data_[i];
}
If I add the line
void assert(bool);
to it's header it will stop complaining and temperorily links well and the
program runs well. But when I include that header is some other files, I'll
get linking problem with undefined (not doublely defined)assert. Again,
I've had no problem in linux.
I've noticed that in the /usr/bin/include assert.h has a
#if __DARWIN_UNIX03
..............
#else
.....
#endif
I first thought that is a bug and #if should be #ifdef. I tried changing
that, but it doesn't help my compiling/linking problem.
Does anyone have any experience with a problem like this?
Thanks.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- assert.h for OS X,
rsina <=