[quote=“patrickm”]…
That’s based on my (apparently flawed) reading of Section 7.9 of the user’s guide:
“Instead of having CINT interpret your script there is a way to have your scripts compiled, linked and dynamically loaded using the C++ compiler and linker…you can use language constructs that are not fully supported by CINT.”
I understand your point that CINT doesn’t interpret C++11 syntax. However, I thought that would be a non-issue – i.e. CINT wouldn’t be used to interpret any code – for code compiled, linked, and loaded via the .L command. In my experience, C++11 syntax has worked just fine when used in this fashion, and that’s without “tricks” of any kind. Furthermore, I’ve been able to successfully use constructs like double vd {-1, 2}; in other macros, as recently as this morning.
[/quote]
One more time: CINT (== macros == interpreted mode) does not support any of C++11 syntax.
void noway()
{
vector<int> v{1,2,3};
std::cout<<v.size()<<std::endl;
}
[quote]root [0] .x noway.C
Error: Symbol v is not defined in current scope noway.C:4:
Error: Failed to evaluate v.size()
(class G__CINT_ENDL)140613809887664
*** Interpreter error recovered *[/quote]
The same documentation you quoted also mentions, that CINT is still used to generate a dictionary for you class. You can hide some difficult parts from CINT.
But even if you hide the code from CINT completely using
#ifndef CINT or something like this, still you have another problem - compiler invoked by ACLiC procedure (clang in your case) must compile with -std=c++11 to work.
root.cern.ch/download/doc/ROOTUs … s/CINT.pdf:
[quote]1.9.4 Intermediate Steps and Files
ACLiC executes two steps and a third one if needed. These are:
• Calling rootcint to create a CINT dictionary. rootcint is a ROOT specific version of makecint, CINT generic
dictionary generator.
• Calling the compiler to build the shared library from the script
• If there are errors, it calls the compiler to build a dummy executable to report clearly unresolved symbols.
ACLiC makes a shared library with a CINT dictionary containing the classes and functions declared in the script. It
also adds the classes and functions declared in included files with the same name as the script file and any of the
following extensions: .h, .hh, .hpp, .hxx, .hPP, .hXX. …
[/quote]