Since we've been talking about name clashes, what about "assert"
Because lout::misc defines an inline assert function, including dw/core.hh fails if you've already included anything that defines the standard assert macro (such the C++ iostream stuff). You can work around it by including dw/core.hh first, but that feels pretty fragile as it depends on nothing subsequently using the standard assert. What's the best fix? (Example appended.) Regards, Jeremy Henty For example: #include <ios> #include <dw/core.hh> yields (with GCC 3.4.3): In file included from ./../Source/current/dw2/dw/../lout/object.hh:7, from ./../Source/current/dw2/dw/core.hh:39, from dw_assert.cc:9: ./../Source/current/dw2/dw/../lout/misc.hh:36:55: macro "assert" passed 3 arguments, but takes just 1 In file included from ./../Source/current/dw2/dw/../lout/object.hh:7, from ./../Source/current/dw2/dw/core.hh:39, from dw_assert.cc:9: ./../Source/current/dw2/dw/../lout/misc.hh:37: error: invalid function declaration ./../Source/current/dw2/dw/../lout/misc.hh:185:30: macro "assert" passed 4 arguments, but takes just 1 ./../Source/current/dw2/dw/../lout/misc.hh:198:30: macro "assert" passed 4 arguments, but takes just 1 ./../Source/current/dw2/dw/../lout/misc.hh:213:30: macro "assert" passed 4 arguments, but takes just 1 ./../Source/current/dw2/dw/../lout/misc.hh: In member function `T* lout::misc::SimpleVector<T>::getRef(int)': ./../Source/current/dw2/dw/../lout/misc.hh:184: error: `assert' undeclared (first use this function) ./../Source/current/dw2/dw/../lout/misc.hh:184: error: (Each undeclared identifier is reported only once for each function it appears in.) ./../Source/current/dw2/dw/../lout/misc.hh: In member function `T lout::misc::SimpleVector<T>::get(int)': ./../Source/current/dw2/dw/../lout/misc.hh:197: error: `assert' undeclared (first use this function) ./../Source/current/dw2/dw/../lout/misc.hh: In member function `void lout::misc::SimpleVector<T>::set(int, T)': ./../Source/current/dw2/dw/../lout/misc.hh:212: error: `assert' undeclared (first use this function) make[1]: *** [dw_assert-dw_assert.o] Error 1
On Sun, Apr 27, 2008 at 08:52:31AM +0100, Jeremy Henty wrote:
Because lout::misc defines an inline assert function, including dw/core.hh fails if you've already included anything that defines the standard assert macro (such the C++ iostream stuff).
You can work around it by including dw/core.hh first, but that feels pretty fragile as it depends on nothing subsequently using the standard assert. What's the best fix?
(Example appended.)
I also see this with gcc 3.4.6, but not with gcc 4.1.2. Regards, Johannes
Regards,
Jeremy Henty
For example:
#include <ios> #include <dw/core.hh>
yields (with GCC 3.4.3):
In file included from ./../Source/current/dw2/dw/../lout/object.hh:7, from ./../Source/current/dw2/dw/core.hh:39, from dw_assert.cc:9: ./../Source/current/dw2/dw/../lout/misc.hh:36:55: macro "assert" passed 3 arguments, but takes just 1 In file included from ./../Source/current/dw2/dw/../lout/object.hh:7, from ./../Source/current/dw2/dw/core.hh:39, from dw_assert.cc:9: ./../Source/current/dw2/dw/../lout/misc.hh:37: error: invalid function declaration ./../Source/current/dw2/dw/../lout/misc.hh:185:30: macro "assert" passed 4 arguments, but takes just 1 ./../Source/current/dw2/dw/../lout/misc.hh:198:30: macro "assert" passed 4 arguments, but takes just 1 ./../Source/current/dw2/dw/../lout/misc.hh:213:30: macro "assert" passed 4 arguments, but takes just 1 ./../Source/current/dw2/dw/../lout/misc.hh: In member function `T* lout::misc::SimpleVector<T>::getRef(int)': ./../Source/current/dw2/dw/../lout/misc.hh:184: error: `assert' undeclared (first use this function) ./../Source/current/dw2/dw/../lout/misc.hh:184: error: (Each undeclared identifier is reported only once for each function it appears in.) ./../Source/current/dw2/dw/../lout/misc.hh: In member function `T lout::misc::SimpleVector<T>::get(int)': ./../Source/current/dw2/dw/../lout/misc.hh:197: error: `assert' undeclared (first use this function) ./../Source/current/dw2/dw/../lout/misc.hh: In member function `void lout::misc::SimpleVector<T>::set(int, T)': ./../Source/current/dw2/dw/../lout/misc.hh:212: error: `assert' undeclared (first use this function) make[1]: *** [dw_assert-dw_assert.o] Error 1
_______________________________________________ Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
On Sun, Apr 27, 2008 at 06:58:22PM +0200, Johannes Hofmann wrote:
On Sun, Apr 27, 2008 at 08:52:31AM +0100, Jeremy Henty wrote:
Because lout::misc defines an inline assert function, including dw/core.hh fails if you've already included anything that defines the standard assert macro (such the C++ iostream stuff).
I also see this with gcc 3.4.6, but not with gcc 4.1.2.
That's surprising (at least to me). I guess gcc4 must resolve names differently? Or maybe it's smart enough not to macro-expand anything that looks like a macro token but appears somewhere where no macro token should? Anyway, I have no axe to grind on this, I just raised it as a concern. Regards, Jeremy Henty -- What is Jewish decision theory? Maximize regrets. -- Sidney Morgenbesser
participants (2)
-
Johannes.Hofmann@gmx.de
-
onepoint@starurchin.org