is there an equivalent command to sizeof() for c++ in tcl? i would like to grab the size of a variable but i can't find any commands that seam to be of use.
Tcl provides "llength" and "string length" to obtain character and list lengths.
When it comes to strings, it's simple enough to say 3 characters are 3 bytes long (as Tcl doesn't use a null terminator, though it's memory will, this is upt o you to count for if you so wish).
When it comes to numbers in C/++, things are not the same.
To place things in basics (I am no expert, and I am going from memory). With numbers, 1 byte can hold the values 0 through to 255, and 2 bytes can hold 0 through 65535.
In reality, a 1 byte number, and a 1 byte character are the same things, as the character is selected from 1 of 256 possible values/characters.
What he is asking, is if you have the two values "hello" and "255", how do you get them memory usage values from these. "hello" would produce 5 (without any null terminator, again see above) and "255" would produce 1.
Anyway, to the actual question.
Esentialy, no.
"string length" will help you for characters (depending on your needs). As for numbers, it could be possible to use some math against the values, to generate a sizeof value.
The "string is" commands could help you determine the type of variable, which would allow for a multi-purpose single command for the job.