Type long Vs type long int

What would the following typedef mean and why was it necessary

typedef unsigned long int ULONG; 

how different from

 typedef unsigned long ULONG; 

For gcc, sizeof int = 4, sizeof long = 8 and sizeof ULONG = 8.

+4
source share
4 answers

They are the same. Since long is a modifier for int by default, int can be omitted. The same applies to short and short int , unsigned and unsigned int , etc.

You need to understand that long , short and unsigned are type modifiers, not the types themselves, unlike int , char , double , etc.

+10
source

There is no difference. long is synonymous with long int (just as short has short int ).

+3
source

Actually, an unsigned long not defined in the C ++ Standard ISO / IEC 14882, so if it works for you, it only happens because your compiler interprets the unsigned long int as an unsigned long .

+3
source

The long size is not gcc related, but os

-1
source

Source: https://habr.com/ru/post/1416311/


All Articles