int vs. unsigned

Jan 22, 2008 at 12:48am
Sorry if this has been asked before or if it's in the wrong place. I'm writing a plugin for maya using c++ and one of the sample programs I modified uses const unsigned variableName; Would it ruin it if I changed it to an int? I guess what I'm asking is, what is the difference between 'int' and 'const unsigned'? The numbers are all int-approved (20, 3, etc.). Does it take up less space or something?
Jan 22, 2008 at 9:34am
"const unsigned" is equivalent to "const unsigned int"
"int" is generally equivalent to "signed int"
so there are differences between both: in their constness and in their interpretation of negative and very-high numbers.
They both take the same space in memory though.
Jan 22, 2008 at 3:54pm
Thank you. I suppose I'll just leave it as const unsigned for now. Better safe than sorry.
Topic archived. No new replies allowed.