octave-maintainers
[Top][All Lists]
Advanced

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

Re: C++ namespace question


From: John W. Eaton
Subject: Re: C++ namespace question
Date: Fri, 16 Jun 2017 14:32:36 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 06/16/2017 12:38 PM, Rik wrote:
I need a little C++ help.  I'm deprecating is_NA in favor of isna within
the octave::math namespace.  The modified code in lo-mappers.h is

namespace octave
{
  namespace math
  {
    extern OCTAVE_API bool isna (double x);
    OCTAVE_DEPRECATED (4.4, "use 'octave::math::isna' instead")
    inline bool is_NA (double x) { return isna (x); }

    extern OCTAVE_API bool isna (float x);
    OCTAVE_DEPRECATED (4.4, "use 'octave::math::isna' instead")
    inline bool is_NA (float x) { return octave::math::isna (x); }

In one case, I wrote the inline substitute function without using the
namespace prefix, in the other I kept the prefix.  The code compiles fine,
but which is preferred?

I don't guess it matters in this case since the base name is changing as well, but maybe use the namespace tag just to be clear and avoid any confusion?

If the base name is the same, say "isna" both inside and outside the namespace , then the tag is obviously required.

jwe





reply via email to

[Prev in Thread] Current Thread [Next in Thread]