-4

I'm digging through some code, and a function that I found takes (as one of the arguments)

unsigned const cookie

What does that mean? Does the compiler default that to an unsigned integer, or is unsigned itself a datatype (That doesn't make sense to me)?

Brydon Gibson
  • 1,179
  • 3
  • 11
  • 22
  • See https://stackoverflow.com/questions/1171839/what-is-the-unsigned-datatype. `unsigned` is same as `unsigned int`. – fstop_22 Aug 09 '18 at 12:00
  • What's with the downvoting? This isn't something that's easy to understand and results don't come up anywhere for "unsigned const". Sure I may have missed "unsigned datatype" but that phrase doesn't make sense. – Brydon Gibson Aug 09 '18 at 14:08

2 Answers2

2

Default type for qualifiers such as those in C is int. Therefore,

unsigned const

will be interpreted by the compiler as

unsigned const int

If you're interested, you can find some on this behaviour in those posts:

Siegmeyer
  • 4,312
  • 6
  • 26
  • 43
0

unsigned is a keyword to specify that a numeric data type won't have values below zero.

If you create a unsigned identifier without specifying the data type, int will be assumed.

Phiter
  • 14,570
  • 14
  • 50
  • 84