printing constants

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

for (User::op_iterator
Value *v=operand->get();
const Type *t=v->getType();
cerr<<endl<<" operand: "<<"[ "<<v->hasName()<<"
]"<<v->getName()<<" Type:"<<*t<< " it has: "<<

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

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

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