Std namespace in cling

I searched abound on JIRA and RootTalk about this issue, and mostly people talk about how the std:: issues will be fixed in ROOT6. Well we have ROOT6 now and this still happens:

root [0] int next = 5;
ROOT_prompt_0:1:5: error: redefinition of 'next' as different kind of symbol
int next = 5;
/Applications/ note: 
      previous definition is here
next(_ForwardIter __x,

The std:: namespace is getting more and more filled with names. The utility of not having to type std:: for common functions can easily be reproduced with suitable using directives in a rootlogon.C script. Is there a way to disable the inclusion of namespace std & several headers at the cling prompt? I’d much rather manually include and use std::vector, std::cout and friends if it means I can expect well-formed C++ statements to work in ROOT.

Here are some other fun variable names that are banned in ROOT, even without any headers included by the user: next, begin, end, distance, ignore, array, count, map, vector, copy, fill, sort, set, list, hash, string. At the very least, could ROOT users be provided with a list of these banned names so we don’t accidentally use them?


Hi Jean-Francois,

I also faced some “already used” variable names (I think yp1… not sure). When I simply change the name. But I agree with you that is a bit strange when you see that the first time. I am not sure the full list can be provided.
I will ask our cling expert to give you a more complete answer.