Is the compiler allowed to optimize out heap memory allocations?

The history seems to be that clang is following the rules laid out in N3664: Clarifying Memory Allocation which allows the compiler to optimize around memory allocations but as Nick Lewycky points out : Shafik pointed out that seems to violate causality but N3664 started life as N3433, and I’m pretty sure we wrote the … Read more

Compile, Build or Archive problems with Xcode 4 (and dependencies)

NB: The steps below will solve 90% of your Xcode archive issues however, from the comments it is suggested you try quitting Xcode first. This may save you hours of setting tweaking. Check the “user header paths” are correct (Add “” to paths for spaces, both in your project and dependencies) Set “Always search user … Read more

clang-7: error: linker command failed with exit code 1 for macOS Big Sur

This has been challenging, but here are the steps I used compile R packages from source on MacOS Big Sur: Reinstall xcode command line tools (don’t believe Software Update if it says ‘up to date’ – he lies – brew doctor said my version was actually old) sudo rm -rf /Library/Developer/CommandLineTools sudo xcode-select –install Install … Read more

How do I print a list of “Build Settings” in Xcode project?

UPDATE: This list is getting a little out dated (it was generated with Xcode 4.1). You should run the command suggested by dunedin15. dunedin15’s answer can give inaccurate results for some edge-cases, such as when debugging build settings of a static lib for an Archive build, see Slipp D. Thompson’s answer for a more robust … Read more

static variable link error [duplicate]

You must define the statics in the cpp file. Log.cpp #include “Log.h” #include <ostream> string Log::theString; // <—- define static here void Log::method(string arg){ theString = “hola”; cout << theString << endl; } You should also remove using namespace std; from the header. Get into the habit while you still can. This will pollute the … Read more

clang error: unknown argument: ‘-mno-fused-madd’ (python package installation failure)

You can tell clang to not raise this as an error by setting the following environment variables prior compilation: export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments Then pip install psycopg2should work. I had the same when trying to pip install lxml. Edit: if you are installing as superuser (which will likely be the case if you are trying … Read more