Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Reg: Array subscript of a C program using Eclipse CDT

> This is not public API, but you can do something like:
>
>   import org.eclipse.cdt.core.dom.ast.IValue;
>   import org.eclipse.cdt.internal.core.dom.parser.Value;
>
>     IValue value = Value.create(exprn.getSubscriptExpression(), Value.MAX_RECURSION_DEPTH);
>     if (value == Value.UNKNOWN || value.numericalValue() == null)
>             System.out.println("cannot determine value of subscript");
>     else
>             System.out.println("value of subscript is " + value.numericalValue().longValue());

By the way, if someone would like to contribute a public API
version of Value.create(IASTExpression), I think we would be 
happy to accept one.

Regards,
Nate 		 	   		  

Back to the top