OSX 10.11 & XCode 7.3 IDE build - memoryX.h problems

Building and customizing Audacity from the source code.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Mac OS X
GNU/Linux and Unix-like
Post Reply
Posts: 166
Joined: Wed Jan 06, 2016 10:53 am
Operating System: OS X 10.11 El Capitan or later (macOS)

OSX 10.11 & XCode 7.3 IDE build - memoryX.h problems

Post by rachalmers » Fri Apr 29, 2016 8:42 am

Any developers working in this area ?
I'm a little stuck on Audacity/MemoryX.h

.... Too many errors emitted, stopping

Things are looking good for all the other project parts, except for this main ? part - Audacity. Which I've no doubt will only be one of many after it.

It seems to be expecting a __MAC_OS_X_VERSION_MIN_REQUIRED <= __MAC_10_6

as in


Let me be more specific.
This code extract is from MemoryX.h about line 363 - right before the #endif that starts this block - noted above , if <= __MAC_10_6

So the first error generated now is -
"Expected ";" after alias declaration - about line 380, and
"Unknown type name 'unique_ptr" - on about line 380.
I'm saying 'about' because I modified the file once, and moved the line numbers fractionally.

Code: Select all

The first hides naked NEW and DELETE from the source code.
The second hides NEW[] and DELETE[].  Both of course ensure destruction if
you don't use something like std::move(p) or q.release().  Both expressions require
that you identify the type only once, which is brief and less error prone.

(Whereas this omission of [] might invite a runtime error:
std::unique_ptr<Myclass> q { new Myclass[count] }; )

Some C++11 tricks needed here are (1) variadic argument lists and
(2) making the compile-time dispatch work correctly.  You can't have
a partially specialized template function, but you get the effect of that
by other metaprogramming means.

namespace std {
   // For overloading resolution
   template <typename X> struct __make_unique_result {
      using scalar_case = unique_ptr<X>;

   // Partial specialization of the struct for array case
   template <typename X> struct __make_unique_result<X[]> {
      using array_case = unique_ptr<X[]>;
      using element = X;

   // Now the scalar version of unique_ptr
   template<typename X, typename... Args> inline
      typename __make_unique_result<X>::scalar_case
      make_unique(Args&&... args)
      return typename __make_unique_result<X>::scalar_case
      { safenew X(forward<Args>(args)...) };

   // Now the array version of unique_ptr
   // The compile-time dispatch trick is that the non-existence
   // of the scalar_case type makes the above overload
   // unavailable when the template parameter is explicit
   template<typename X> inline
      typename __make_unique_result<X>::array_case
      make_unique(size_t count)
      return typename __make_unique_result<X>::array_case
      { safenew typename __make_unique_result<X>::element[count] };

and yes, I know it's not supported :-) - I am as usual working on my own, way out the front. Just hoping to catch the eye of anyone else working on advanced levels...

Site Admin
Posts: 47292
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: OSX 10.11 & XCode 7.3 IDE build - memoryX.h problems

Post by steve » Fri Apr 29, 2016 8:59 am

rachalmers wrote:Any developers working in this area ?
I'm a little stuck on Audacity/MemoryX.h
The developer of that code is "Paul Licamelli". Try asking on the developer's mailing list: https://lists.sourceforge.net/lists/lis ... city-devel
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply