printing constants

Sir,
I am using the op_begin and op_end iterator for
iterating over the operands as mentioned below.

for (User::op_iterator
operand=j->op_begin(),operand_end=j->op_end();operand!=operand_end;++operand){
Value *v=operand->get();
const Type *t=v->getType();
cerr<<endl<<" operand: "<<"[ "<<v->hasName()<<"
]"<<v->getName()<<" Type:"<<*t<< " it has: "<<
v->getNumUses()<<"--uses";
}

but by using this i am able to print the variables
but not the constants .I am also able to print the
type of the constant but not the constant value.i am
getting a empty space for the constant.What should I
do for getting the constant printed out?

thanking you,

yours sincerely,
suresh anubham
tu darmstadt
germany

v->getName() is always "" for a constant. "v" *is* the constant though.

Try "<< *v" instead of "<< v->getName()".

-Chris