1.1.7 Usage of the scoping resolution operator

In DS-5, the :: (scope resolution) operator is a global identifier for variable or function names that are out of scope. The expression evaluator supports scoping operations using the scope resolution, member and member pointer operators. This can be used to reference variables and functions within images, files, namespaces, or classes.

The following is an example which references image.axf created using demo.c below:

static int FILE_STATIC_VARIABLE = 20;
class OuterClass
{
	public:
	OuterClass(int i)
	{
		value = i;
	}

	class InnerClass
	{
		public:
		int demoFunction()
		{
			return 25;
		}
	};
	void increment()
	{
		value++;
	}
	int value;
};

namespace NAME_SPACE_OUTER
{
	const int TEST_VAR = 20;
	namespace NAME_SPACE_INNER
	{
		const int TEST_VAR = 19;
		int nameSpaceFoo ()
		{
			return 60;
		}
	};
};

int main()
{
	OuterClass oc(14);
	OuterClass *ptr_oc = &oc;

	ptr_oc->increment();
}

You can query this example by using any of the following expressions:

OuterClass::InnerClass::demoFunction
"image.axf"::main
"image.axf"::"demo.c"::FILE_STATIC_VARIABLE
"demo.c"::FILE_STATIC_VARIABLE
NAME_SPACE_OUTER::TEST_VAR
NAME_SPACE_OUTER::NAME_SPACE_INNER::TEST_VAR

If you set a breakpoint at ptr_oc->increment() and run to it, then the following expressions can also be used to query the instances of the outer class:

oc.value
ptr_oc->value
Non-ConfidentialPDF file icon PDF versionARM DUI0452Z
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.