Skip to content

Remove public 'inttypes.h' header#4991

Merged
pks-t merged 1 commit into
masterfrom
ethomson/inttypes
Feb 21, 2019
Merged

Remove public 'inttypes.h' header#4991
pks-t merged 1 commit into
masterfrom
ethomson/inttypes

Conversation

@ethomson
Copy link
Copy Markdown
Member

Remove an inttypes.h header that is too large in scope, and far too
public.

For Visual Studio 2012 and earlier (ie, _MSC_VER < 1800), we do need
to include stdint.h in our public headers, for types like uint32_t.

Internally, we also need to define PRId64 as a printf formatting
string.

@ethomson
Copy link
Copy Markdown
Member Author

Tested on Visual Studio 2012 (aka _MSC_VER = 1700).

Copy link
Copy Markdown
Member

@pks-t pks-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a request for claring up my own lack of knowledge. Definitely looks good to me, though. Always happy to remove unneeded code :)

Comment thread src/cc-compat.h Outdated
#if defined(_MSC_VER) || defined(__MINGW32__)

/* Visual Studio 2012 and prior lack PRId64 entirely */
# if (_MSC_VER < 1800)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be easier to just check if PRId64 is defined instead of relying on the _MSC_VER? No idea though if MSVC is using e.g. a typedef, but I guess you'd know :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you implement PRId64 using a typedef (in C)? AFAIK the only way to implement it is by using preprocessor-macros.

@pks-t
Copy link
Copy Markdown
Member

pks-t commented Feb 20, 2019 via email

@ethomson
Copy link
Copy Markdown
Member Author

So given that this is a clear "No, this is not implemented via a typedef": wouldn't it make sense to just use an #ifndef PRId64 instead of intimately checking the MSVC version?

Agreed. Fixed!

Remove an `inttypes.h` header that is too large in scope, and far too
public.

For Visual Studio 2012 and earlier (ie, `_MSC_VER < 1800`), we do need
to include `stdint.h` in our public headers, for types like `uint32_t`.

Internally, we also need to define `PRId64` as a printf formatting
string when it is not available.
@pks-t pks-t merged commit 9eb098d into master Feb 21, 2019
@pks-t
Copy link
Copy Markdown
Member

pks-t commented Feb 21, 2019

Cool, thanks for this cleanup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants