Evan Carslake
Evan Carslake

Reputation: 2359

C++ Difference between 'int' and 'INT'

I was looking at some code on msdn and they used INT instead of int.

I googled and checked other questions here, all of them were titled int between int, and or in C#.

I am wondering if it would be fine to update all my code with INT

Is there any difference?

Upvotes: 0

Views: 100

Answers (2)

Neil Kirk
Neil Kirk

Reputation: 21813

INT is a typedef of int provided in some headers provided by Microsoft for Windows programming. Whenever you are calling a Windows function that has a parameter of type INT, feel free to use this type in your code.

You should not use INT in place of int in general code, especially if you want it to be portable. There is no guarantee that INT will be defined as anything in a C++ compiler.

Upvotes: 2

fuzzything44
fuzzything44

Reputation: 701

No, you can't use INT as you would int. Since I don't have the code, I can't tell you why they used it, but my guess would be that in some include, they had the line #define INT int.

Upvotes: 1

Related Questions