activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Strasheim (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AMQCPP-31) Consider giving the unix #define a more unique name
Date Sat, 23 Dec 2006 01:48:02 GMT
    [ https://issues.apache.org/activemq/browse/AMQCPP-31?page=comments#action_37759 ] 
            
Albert Strasheim commented on AMQCPP-31:
----------------------------------------

Autoconf's HAVE_ defines will definately give more fine-grained control over the platform-specific
code. I think this will be useful as Thread, Mutex and the socket code starts making their
way onto more platforms.

IIRC, you can tell autoconf to prefix the defines it puts in config.h somehow, so that you
get stuff like ACTIVEMQ_CPP_HAVE_FOO.

I think using multiple autoconf-built libraries with config.h's that define mostly the same
stuff but differ slightly in one or two options together in a program can still lead to crazy
things happening if they don't each prefix their HAVE_ defines. YMMV.

Also keep in mind that if the number of options starts to escalate, it would be nice to provide
a default config.h for Windows containing some sensible defaults. But this probably isn't
an issue in this case, since ActiveMQ-CPP's only dependency is CppUnit (I think?).

> Consider giving the unix #define a more unique name
> ---------------------------------------------------
>
>                 Key: AMQCPP-31
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-31
>             Project: ActiveMQ C++ Client
>          Issue Type: Wish
>    Affects Versions: 1.0, 1.1
>            Reporter: Albert Strasheim
>         Assigned To: Timothy Bish
>             Fix For: 1.1
>
>
> src\main\activemq\concurrent\Mutex.h and src\main\activemq\concurrent\Thread.cpp check
if "unix" is defined to enable UNIX-specific functionality.
> From what I've seen in other projects, it's considered a good practice to "scope" your
defines, i.e. unix should rather be something like ACTIVEMQ_CPP_UNIX. This virtually eliminates
problems when integrating multiple libraries, where defines like "unix" might mean different
things to different libraries, meaning the user will have to do some messy preprocessor gymnastics
when trying to include headers from multiple libraries in the same file.
> This also provides an obvious naming convention for other defines. Need, e.g., OpenBSD-specific
code? Use ACTIVEMQ_CPP_OPENBSD. On Unix systems, autoconf can probably take care of this kind
of thing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message