2014-09-09 17:58 GMT+02:00 Michael Wojcik <[email protected]>:
>> I did that, but if a openssl header file includes standard C headers
>> that I don't include, then the namespace declaration would affect them
>> too, am I wrong?
>
> It shouldn't. The C standard says that the second and subsequent inclusion of
> a standard header has no effect, and I believe the current C++ standard
> inherits that rule.
>
> All the implementations I know of (with maybe some special exceptions like
> Splint) implement that with "inclusion guards" - conditional-compilation
> directives around all the contents of the file.
>
> So if a standard header is included once outside any namespace, then if it's
> included again inside a namespace, it shouldn't declare anything in that
> namespace, because all its contents should be skipped. I believe namespaces
> don't affect macro identifiers, so the guards should work.
>
> I could be wrong about that, though. I haven't tried it myself, and I don't
> know the C++ standard nearly as well as the C one.
May be I was not clear, but what I mean is:
- Let's suppose openssl/foo.h has a #include <stdlib.h>.
- In myproject.h I add:
namespace myproject {
#include <openssl/foo.h>
}
- And then in myproject.cpp I write:
p = (char*)malloc(sizeof(char) * 100);
Would this produce the "malloc not found, may be you mean
'myproject::malloc'?" error?
PS: Note that I do NOT include <sdtlib.h> in myproject.*.
--
Iñaki Baz Castillo
<[email protected]>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]