Re: reading data type
* Adam Chapman:
Im completely new to c++ and I am trying to interface some c++ source
code with matlab. Mt question is:
I there a way to find the data type of a variable other than searching
through the code to see where it was defined?
What I would like to do is use a printf statement
Being a novice in C++, it would be much less chance of things going
wrong by using the more type safe iostreams, e.g.
std::cout << "Hello" << std::endl;
It typically drags in a lot of baggage that makes your executable or
library or whatever insanely large, and the code is more verbose too.
But better a bloated thing that works than a lean and mean one that's
incorrect.
to show the type of a certain variable.
std::cout << typeid(v).name() << std::endl;
(IIRC).
However, a C++ implementation is not required to produce any
human-readable text here.
But it might help.
Another more practical way is to use a modern IDE, right click on the
variable and choose "go to definition" or the like, or just hover the
mouse over the variable to see the definition.
Cheers, & hth.,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?