[Nobug] NoBug inconsistency or feature
Christian Thaeter
ct at pipapo.org
Thu Aug 26 16:44:26 CEST 2010
On Thu, 26 Aug 2010 14:17:12 +0200
<benny.lyons at uniserv.com> wrote:
> Hi,
> While playing around with NoBug, I came across something that caused
> me a few heartaches until I got to the bottom of the matter.
>
> I've got a makefile with 3 different targets corresponding to the 3
> different
> NoBug build-levels: alpha, beta and release. Each target has its own
> -D flag, specifying either EBUG_ALPHA, ...
>
> Now I had a #define somewhere in one of my source files: something
> like #define EBUG_BETA
>
> Building with targets release caused a compiler error...that's good,
> but building target ALPHA, didn't do anything (I think building
> target BETA caused
> a warning)!
>
> If you got the build level defined to two different levels, I think it
> would be
> better if the compiler came back with an error instead of the current
> tolerant usage
> where one of the debugging levels wins and the user is left with a
> surprise as
> to which debugging level results. The user can then go and figure out
> which build
> level is actually preferred.
>
> I've locally fixed this in nobug.h with something like:
> #ifdef EBUG_ALPHA
> #ifdef EBUG_BETA
> #error Some error message
> #endif
> #endif
>
> Is this bad or is there some purpose to having tolerant behaviour?
gotcha, you hit some undocumented, untested and possibly not even fully
working feature. NoBug uses the NOBUG_IF_ALPHA() (..BETA,..RELEASE)
macros to switch between implementation and does not use a static #ifdef
ALPHA.. #elif BETA ... switch to make it eventually possible to build
different parts of a program at different build levels even possibe
switching build levels within a translation unit. This is only
done with some forethought but not well specified/implemented yet.
For the time being a project should only be build with one
build-level, otherwise you end up in undefined-land. I am quite
interested in changing this some day but for now we have other
priorities.
Christian
>
>
> Ta
> Benny
> _______________________________________________
> Nobug mailing list
> Nobug at lists.pipapo.org
> http://lists.pipapo.org/cgi-bin/mailman/listinfo/nobug
More information about the Nobug
mailing list