1. The command from the x86 instruction set that calls a software interrupt, for example INT 21H to call a DOS function. 2. A keyword used in C, C++ and other languages to declare or indicate an integer type. It is supposed to be of the word size of the machine, so that instructions on it will be faster. Can be signed, unsigned. Two other integer types are char and long.

int is a type used in many C-like languages, including C itself, C++, Objective C, Inform, Java, and C#. It indicates an integer type, which is to say a whole number. The upper and lower bounds of values able to be stored as int vary depending on the language, platform, and, if applicable, modifiers used.

For any given compiler and platform combination, it is usually a valid assumption that a natural int is the same size as the word size of that architecture, which may or may not be the same size as pointers. However, for portability reasons, it is strongly deprecated to ever code to utilise these assumptions.

In most languages, int is a built-in, or atomic type. It is also usually a keyword.

The following comments refer specifically to the C language, and extensions thereto such as C++.

Under C, int is the default type. This mean that if a type is omitted where one is required, it is assumed to be int. For that reason, the following three declarations are valid (taken out of context, naturally):

auto count;
static g_CharBroiled=0;
size(struct MAP *map) { return map->size; }

Note than in the variable declarations above, if the type is omitted, a storage class is still required so that the compiler recognizes the line as a declaration rather than a reference to an existing name. Declaration by omission of type name is deprecated under C++.

C supports four modifiers to the int type: signed, unsigned, short, and long. signed is mutually exclusive to unsigned, as short is to long. These modifiers can be used to prefix the int keyword, or without the int keyword in which case it is implicit.

If unsigned is not specified, the type is a signed type, meaning that both negative and non-negative numbers are within the range of the type. unsigned types only hold non-negative values. A signed int of the same size as an unsigned int will usually have an upper bound of half the upper bound of the unsigned, and its lower bound will be compensatorially lower. I have no idea if compensatorially is really a word.

The short and long modifiers affect the size, which is say memory and therefore upper and lower bounds, of the type. short and long ints may or may not be the same size as a so-called "natural" int, or int with no size modifier.

Specifically, regarding these modifiers, the ANSI C standard requires that:

sizeof(short int) <= sizeof(int) <= sizeof(long int)

It is a limitation of the C language that there are a maximum of three non-char sizes of integers available. This can be problematic with the onset of 64-bit architectures for compilers that wish to support very large integers without changing the meaning of existing pointer sizes and thereby break code.

So, various compilers have various ways of getting around this limitation, with varying degress of ugliness. Some implementations support an __int64 extension and some brain-damanged implementations support the very non-ANSI-compliant long long notation.

In the Java language, int is still a built-in keyword type, but it does not support any modifiers. Instead, short and long are types independently, and all three are signed in all cases. The Java platform specification indicates specific sizes for the int, short, and long types, being 32-bit, 16-bit, and 64-bit respectively.

In addition to its meaning as a type symbol in several languages, INT is also the Interrupt mnemonic in x86 assembly language, corresponding to opcode CD and taking an immediate 8-bit argument. INT is a priveleged instruction and only has its described function in kernel or driver (which is to say, ring 0 and ring 1) code or in real mode. Application code executing an INT should be abnormally terminated.

INT will invoke the interrupt handler indicated by its argument. In real mode, this means, given argument immed8, it will push onto the stack (E)FLAGS and CS:(E)IP and jump to the address stored at (4*immed8), segment 0. In protected mode, the location of the interrupt vector table can be changed, and in the fact the vectors themselves may be in the form selector:offset rather than segment:offset, or may indicate a physical address, depending on the OS. I frankly don't recall, but I recommend Intel's Technical Reference Manual on the subject for those interested in Protected Mode arcana.

INT 3 is a special exception that has a one-byte representation of CC. This opcode is used by cheesy real-mode debuggers to place breakpoints in client code. The two-byte opcode CD 03 is equivelent.

See also the related x86 mnemonic INTO (Interrupt on Overflow).

Log in or register to write something here or to contact authors.