activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian McFarland (JIRA)" <>
Subject [jira] Commented: (AMQCPP-253) Problems with compiler aCC on HPUX
Date Mon, 09 Nov 2009 22:45:52 GMT


Brian McFarland commented on AMQCPP-253:

Timothy & Wolfgang:

The problem I'm having with Pointer.h is that HP-UX defines NULL as a long, not a void *.
 So when you do something like this:

Pointer<SomeType> p;
if( p != NULL )

you get an error about template deduction failing to find a match for operator!= for comparing
Pointer<SomeType> to long.

The fix Wolfgang proposed was to use operator bool.  Operator bool will convert both NULL
and the Pointer instance to a bool.  That works great for the case above, but causes problems
for something like this:

Pointer<SomeType> p1, p2;
if( p1 == p2 )

The compiler might end up casting both Pointers to bool, and if both pointers are either null
or non-null, then "==" results in true, which is not the desired result.

A safer option is to use operator void * as follows:
operator void * const {
    return (void *) this->value;

It acheives the same effect, because Pointer and NULL will both be cast to void *, but since
Pointer the pointer still has a meaningful value, it no longer causes problems with Pointer
to Pointer comparison.

Wolfgang:   I'm assuming by "HP's native compiler", you mean aCC?  If so, which version &
what version of HP-UX?

> Problems with compiler aCC on HPUX
> ----------------------------------
>                 Key: AMQCPP-253
>                 URL:
>             Project: ActiveMQ C++ Client
>          Issue Type: Improvement
>    Affects Versions: 3.0
>         Environment: HP-UX gemma1 B.11.23 U 9000/800
> aCC: HP ANSI C++ B3910B A.03.77
>            Reporter: Wolfgang.Klein
>            Assignee: Timothy Bish
>            Priority: Minor
>             Fix For: 3.1
>         Attachments: amq_cpp_30.tar
> compile errors with native HP compiler

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message