[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-dev] various evils



Daniel Russel wrote:
I think it is a bit evil to have NDEBUG defined when building the swig library but not any other time. Any function declared in a header can then asserts turned off.

Even worse, various things can change memory layout when NDEBUG is defined, resulting in random crashes if modules are mixed. We probably should make sure IMP doesn't have this property, but I have encountered other libraries which do such things.

I think 'evil' is a strong word for it. ;) But as of r654, there is a 'release' scons option. By default it is False, which will build both regular libraries and SWIG extensions without -DNDEBUG. If you turn release on, it'll set NDEBUG for everything. But we definitely shouldn't have different memory layouts in the two cases - that is a really sloppy ABI.

On a separate note, since it has been bugging me a bit, you are not supposed to use identifiers starting with _ or __ as these are reserved for the compiler. All our header guards start with __. Frankly, I don't expect this to ever cause problems, but such are the rules.

A huge number of libraries use __ for their header guards, so I'd be very surprised if this were to ever cause problems. For example, freetype, gmp, mpfr and glib on my Mac use __. A bunch of others use a single _, and those with _ or __ are a distinct minority (the situation is even more pronounced for the stuff in /usr/include). So I think you can sleep comfortably.

	Ben
--
                      http://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
	- Sir Arthur Conan Doyle