users now store a copy of nullArray or a pointer to it?
It will create an independent copy. As I understand since both nullArray
and SomeDataList
are state variables there will be two independent copies.
It's mentioned in the solidity docs here that,
assignments between storage and memory and also to a state variable
(even from other state variables) always create an independent copy.
hence,
I push some data to this structure and I'm not sure whether the
global variable nullArray will be affected or not
nullArray
will not be affected.
UPDATE
I tried your code with some additional functions in Remix-IDE as follow,
pragma solidity^0.4.16;
contract Test {
struct SomeData {
address[] users;
}
address[] nullArray;
mapping(uint => SomeData) SomeDataList;
function insertData(uint number) {
SomeDataList[number] = SomeData({
users : nullArray
});
SomeDataList[number].users.push(msg.sender);
}
function getusers(uint number) constant returns(address []){
return SomeDataList[number].users;
}
function getNullArray() constant returns(address[]){
return nullArray;
}
function pushNullArray(address addr){
nullArray.push(addr);
}
}
And nullArray
and SomeDataList
acted as two different variables. Here are the function call results after calling pushNullArray(address addr)
and insertData(uint number)
with some arbitrary values.

They were not the same.
Hope this helps!