By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,678 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,678 IT Pros & Developers. It's quick & easy.

including C header "stdint.h" in C++

P: n/a
I'm wondering if there are any compelling reasons NOT to use the types
defined in stdint.h in c-programms?

Please refer to this thread:
http://groups.google.com/groups?hl=e...pacific.net.au

Thanks
Jul 22 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
J. Campbell wrote:
http://groups.google.com/groups?hl=e...nzzb.3886%24xm
.135697%40nasal.pacific.net.au


Portability to older compilers?

--
gabriel
Jul 22 '05 #2

P: n/a
J. Campbell wrote:
I'm wondering if there are any compelling reasons NOT to use the types
defined in stdint.h in c-programms?

Please refer to this thread:
http://groups.google.com/groups?hl=e...pacific.net.au

Thanks

1) It's not standard C++.

2) numeric_limits provides a solution that is.

Jul 22 '05 #3

P: n/a

Jeff Schwab skrev i meldingen <7L********************@comcast.com>...
J. Campbell wrote:
I'm wondering if there are any compelling reasons NOT to use the types
defined in stdint.h in c-programms?

Please refer to this thread:
http://groups.google.com/groups?hl=e...3886%24xm.1356
97%40nasal.pacific.net.au
1) It's not standard C++.


It will be (at least, all indications are that it will be).

2) numeric_limits provides a solution that is.


Nope. No fixed sized or minimum size types in numeric_limits.

Jul 22 '05 #4

P: n/a
J. Campbell wrote:
I'm wondering if there are any compelling reasons
NOT to use the types defined in <stdint.h> in C 99 programs?


These definitions have not been included in the ANSI/ISO C++ standards
[yet] -- there is no standard <cstdint> header file yet.

Try defining your own:

#ifndef GUARD_CSTDINT
#define GUARD_CSTDINT 1
#include <stdint.h>
#endif//GUARD_CSTDINT

Jul 22 '05 #5

P: n/a
Alf P. Steinbach wrote:
Jeff Schwab skrev i meldingen <7L********************@comcast.com>...
J. Campbell wrote:
I'm wondering if there are any compelling reasons NOT to use the types
defined in stdint.h in c-programms?

Please refer to this thread:

http://groups.google.com/groups?hl=e...3886%24xm.1356
97%40nasal.pacific.net.au
1) It's not standard C++.

It will be (at least, all indications are that it will be).


When it is, I'll use it.
2) numeric_limits provides a solution that is.


Nope. No fixed sized or minimum size types in numeric_limits.


You're right, but it's not hard to use numeric_limits to find out what
sizes are available, and typedef them accordingly. This is what I do
for code that must run on both 32- and 64-bit systems.

Well, perhaps I'll give stdint a look.

Jul 22 '05 #6

P: n/a
"Alf P. Steinbach" <al***@start.no> writes:
Jeff Schwab skrev i meldingen <7L********************@comcast.com>...
J. Campbell wrote:
I'm wondering if there are any compelling reasons NOT to use the types
defined in stdint.h in c-programms?

Please refer to this thread:
http://groups.google.com/groups?hl=e...3886%24xm.1356
97%40nasal.pacific.net.au


1) It's not standard C++.


It will be (at least, all indications are that it will be).

2) numeric_limits provides a solution that is.


Nope. No fixed sized or minimum size types in numeric_limits.


You could use boost/cstdint.hpp for this
See http://www.boost.org/libs/integer/cstdint.htm

kind regards
frank

--
Frank Schmitt
quattro research gmbh phone: +49 89 700763-0
e-mail: schmitt NO at SPAM quattro-research !@! dot com
Jul 22 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.