Eric Lemings wrote:
>
> 
>This is part of the <type_traits> header:
>
>       $TOPDIR/include/type_traits:
>         ...
>         30 #ifndef _RWSTD_TYPE_TRAITS_INCLUDED
>         31 #define _RWSTD_TYPE_TRAITS_INCLUDED
>         32
>         33 #include <rw/_defs.h>
>         34
>         35 #ifdef _RWSTD_NO_EXT_CXX_0X
>         36 #  error _RWSTD_NO_EXT_CXX_0X defined and C++0x header
>included
>         37 #endif
>         ...
>
>Shouldn't lines 35-37 come before line 30 so the header isn't even
>parsed if there is an include error?  In other words:
> 
>       ...
>       #ifdef _RWSTD_NO_EXT_CXX_0X
>       #  error _RWSTD_NO_EXT_CXX_0X defined and C++0x header included
>       #endif
>
>       #ifndef _RWSTD_TYPE_TRAITS_INCLUDED
>       #define _RWSTD_TYPE_TRAITS_INCLUDED
>
>       #include <rw/_defs.h>
>       ...
>

You have to include rw/_defs.h before you do the _RWSTD_NO_EXT_CXX_0X
check because that macro might be defined in one of the files included
from there. So that means moving the rw/_defs.h include outside of the
header guard. This would require an additional file open [or a lookup at
the very least] as well as a condition check every time the file was
included from client code.

>It doesn't look conventional but, technically, it is slightly more
>efficient.

I'd like to see some evidence that this change would have any noticeable
effect in terms of compile times.

>
>Brad.
>

Reply via email to