Why is this program erroneously rejected by three C++ compilers?
Originally from Overv @ reddit.
Originally from Overv @ reddit.
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
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
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
That’s correct; asking for a pointer as input to inline asm does not imply that the pointed-to memory is also an input or output or both. With a register input and register output, for all gcc knows your asm just aligns a pointer by masking off the low bits, or adds a constant to it. … Read more
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
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
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
Stripping out the .cfi directives, unused labels, and comment lines is a solved problem: the scripts behind Matt Godbolt’s compiler explorer are open source on its github project. It can even do colour highlighting to match source lines to asm lines (using the debug info). You can set it up locally so you can feed … Read more