Chris Schmitz
Chris Schmitz

Reputation: 20940

What does cstdint stand for?

I know the purpose of cstdint as a header to provide more accurate descriptions for numbers, but what does the actual header name stand for?

I have a hard time remembering shortened names, especially in programming, when I don't know what the full name is. I imagine it's something like "c standard type defintions integers" or something, but I can't quite find the explanation of the name.

What is the etymology of cstdint?

Upvotes: 1

Views: 379

Answers (2)

Naman Jain
Naman Jain

Reputation: 335

<cstdint> has code from the C header stdint.h. C++ has a convention where C headers have the same base name, except for a leading c and no trailing .h

Upvotes: 2

John Kugelman
John Kugelman

Reputation: 361605

"C standard library integer support header" is a reasonable description.

  • The c prefix indicates that it's a carryover from C, where it is called <stdint.h>. It's standard practice for C headers named <foo.h> to be named <cfoo> in C++.

  • The std part is because it's part of the C standard library, and parallels other C library headers like <stdio.h> ("standard I/O") and <stdlib.h> ("standard library" -- an admittedly super generic name for what amounts to a grab bag of general purpose functionality that didn't fit into other headers).

  • As you've guessed, the int part is because it provides a bunch of integer types and constants.

Upvotes: 5

Related Questions