Closed aflux closed 10 years ago
This is only possible in c++0x (which is still unavaible in the basic g++ os osx)
this doesn't compile on osx (you need a decent compiler)
unsigned char * allocateandfill (int n) { unsigned char *p=new unsigned char[n] {'\x01','\x02'}; return p; }
int main () { int n=100; unsigned char *p=allocateandfill(n); for (int i=0;i<n;i++) { std::cerr << i << "\t" << (int)p[i] << std::endl; } }
ok it seems to be possible using macports, but you have to do this: sudo port select --list gcc sudo port select --set gcc mp-gcc48
and -std=c++11 flag should be turned on
In fact qmake wants to build with system gcc... so you need to hack the neutrino.pri to force new compiler and this break the compilation (probably because QT is built upon gcc4.2)
and add these to neutrino.pri to tackle the default qmake definitions
QMAKE_CC = gcc QMAKE_CXX = g++ QMAKE_LINK = $$QMAKE_CXX QMAKE_LINK_SHLIB = $$QMAKE_CXX
worth the candle?
done with memcpy
static colormaps should be staticly written as
unsigned char * p = "\x01\x02\x03\x04...";
instead of
p[0] = 0x01; p[1] = 0x02; p[2] = 0x03; ...