Manali Bhadsalkar
Manali Bhadsalkar

Reputation: 43

Does following syntax consider basic type as integer?

typedef unsigned xyz_t;

here xyz_t is user defined name.

Is 'integer' implicit in this case?

Upvotes: 0

Views: 88

Answers (4)

Mithun K
Mithun K

Reputation: 9

Yes.

unsigned is the same as unsigned int.

Upvotes: 0

463035818_is_not_an_ai
463035818_is_not_an_ai

Reputation: 122830

unsigned is the short way of writing unsigned int. See here for a more complete list of integer types and their equivalent ways to write them.

After the typedef xyz_t is an alias for unsigned int.

Upvotes: 5

L. F.
L. F.

Reputation: 20619

Per Table 11 of N4659 (the C++17 standard final draft):

Specifier(s)  Type

[...]
unsigned      “unsigned int”
unsigned int  “unsigned int” 
[...]

Therefore, unsigned has exactly the same meaning as unsigned int in this case.

Upvotes: 2

user7860670
user7860670

Reputation: 37599

xyz_t in this context is declared to be a type alias to unsigned int type. If xyz_t is previously declared in the same scope to be some other, non basic data type, then this code will cause compile time error.

Upvotes: 1

Related Questions