Jump to content

What on earth is the int variable type?


Recommended Posts

int is equal to short. Int is used in C and if you type int instead of short, you should get an error I guess in CS. I bet you have been reading Idles C scripts, mixing them up :wink:

 

The size of the integer can variate depending on what you will use it for and I never use a bigger one that I will need but not the short in Oblivion as it is 16-bit and the limit it can hold is 2^15-1 (32767) or [/size]-2^15 (-32768)[/size]. If we want to use a bigger variable, then we must use the Long variable type

 

There is an exception: OBSE

 

NOTE : Long ago, an OBSE developer mentioned that, internally, the engine stores ALL vars as floats. (QQuix) so it is no problem if you set short value above 32767, the maximum limit positive number is 2,147,483,647 (or hexadecimal 7FFF,FFFF16)

Edited by Pellape
Link to comment
Share on other sites

I should clarify, I know what an int is in general, and I'm used to it being an unsigned long (like in C++)

 

My problem is that I have 0 clue what it means for Oblivion. In Oblivion all numbers are stored as floats, and the only other number types are signed short and longs

int test

Begin OnActivate
  let test := 9.9
  PrintC "number %g", test
End

This is completely valid in Oblivion, but what is this type actually? I can't find any information on its range. This type does truncate floats properly, but that's all I can conclusively state along with ints being signed still

 

The CS wiki only mentions shorts and longs, and the OBSE docs doesn't describe it at all (but still describes certain function parameters and results as being of the type int)

Edited by KatsAwful
Link to comment
Share on other sites

Why so many sorts of types? Good question but is about optimating the code as much as possible I guess. In a PC it doesn't matter but lets see if we use the code in a tiny machine or in an old computer with low RAM, then it matters. The smallest type I ever used is bol, bolean which I suspect is a 2-bit type. In Visual Basic there is no need to declare any variables as if you do not, it will become a common 32-bit type, that can hold any form of value, from strings, integers, floats or whatever. That is cheating but that is basic and we do not need to declare variables in basic ever if we do not want too.

 

Good point as I do not have a clue as I first thought you mixed C up with Oblivion.... ;)

Edited by Pellape
Link to comment
Share on other sites

Cool. It do explain some and I think it is good as then it also means that the FPU will do the calculations and trunc any crap out as 1+1 might be 2.000001... The CPU are needed for other stuff anyway.

 

My first 386, did not have a FPU, so if I did not think while typing C on it, and used float, it would CRASH. I had to use the Atari if I wanted to use floats... ;) It was possible to buy a separate FPU though, if I wanted one.

 

JustChill?? Where do you use bools? In Oblivion or with C?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...