Null<unsigned>

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Null<unsigned>

Vadim Ogranovich-3
Hi,

There is no specialization of Null<unsigned>. Is it by design?
It is confusing as Null<unsigned>() produces 0 on my machine (g++ v3.x), and
this is completely compiler specific.

Another question is why the code below is contingent on defined(__DOXYGEN__)
?

Thanks, Vadim

    #if !defined(__DOXYGEN__)
    template <>
    class Null<int> {
      public:
        Null() {}
        operator int() const { return QL_MAX_INT; }
    };

    template <>
    class Null<double> {
      public:
        Null() {}
        operator double() const { return QL_MAX_DOUBLE; }
    };
    #endif

--------------------------------------------------
DISCLAIMER
This e-mail, and any attachments thereto, is intended only for use by the
addressee(s) named herein and may contain legally privileged and/or
confidential information.  If you are not the intended recipient of this
e-mail, you are hereby notified that any dissemination, distribution or
copying of this e-mail, and any attachments thereto, is strictly prohibited.
If you have received this e-mail in error, please immediately notify me and
permanently delete the original and any copy of any e-mail and any printout
thereof.

E-mail transmission cannot be guaranteed to be secure or error-free.  The
sender therefore does not accept liability for any errors or omissions in
the contents of this message which arise as a result of e-mail transmission.

NOTICE REGARDING PRIVACY AND CONFIDENTIALITY

Knight Trading Group may, at its discretion, monitor and review the content
of all e-mail communications.



Reply | Threaded
Open this post in threaded view
|

Re: Null<unsigned>

Luigi Ballabio-4
At 03:35 PM 5/5/02 -0500, Vadim Ogranovich wrote:
>There is no specialization of Null<unsigned>. Is it by design?

No, it is just that we didn't need it yet. Kind of sloppy on me :(
We should provide specializations for the other built-ins.

>It is confusing as Null<unsigned>() produces 0 on my machine (g++ v3.x), and
>this is completely compiler specific.

Not entirely computer-specific, I think.
     return unsigned();
should give you 0 no matter what. But anyway, we should specialize that.

>Another question is why the code below is contingent on defined(__DOXYGEN__)
>?
>
>    #if !defined(__DOXYGEN__)
>     template <>
>     class Null<int> {
>       public:
>         Null() {}
>         operator int() const { return QL_MAX_INT; }
>     };
>
>     template <>
>     class Null<double> {
>       public:
>         Null() {}
>         operator double() const { return QL_MAX_DOUBLE; }
>     };
>     #endif

I just wanted the above not to appear in the Doxygen-generated
documentation as it would have been redundant---only the returned value is
specialized, not the interface which is the thing Doxygen documents.

Bye,
         Luigi