Questions about VAR_DECL and DECL_EXPR

Jerry Quinn jlquinn@optonline.net
Tue Jun 16 12:14:00 GMT 2009


Hi, again,

I am a little unclear on VAR_DECL and DECL_EXPR.  The impression I get
from reading the docs is that when a variable is first declared in a
function, a VAR_DECL should be created, possibly with DECL_INITIAL()
set.

What's less clearly stated is what you use for variable references later
in the code.  I think you also use VAR_DECL for this purpose, but I'm
not sure.  Could someone clarify?  If so, must it be the same tree node
or does it just have to be another VAR_DECL with the same variable name?

There is also DECL_EXPR representing local declarations, which appears
to be related.  How do these get used and would it even be used in a
C-like language?

Thanks,
Jerry Quinn




More information about the Gcc mailing list