f



Is <cstdlib> required?

Is the <cstdlib> header file required?  I have noticed that in some
implementations it appears to be automatically included.  Maybe it's picked
up by <iostream> or some other common header file, but I can't find any
reference on this.  Does the "standard" have anything to say on its
inclusion by other header files?


-- 
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

0
Joe
2/16/2016 7:03:40 AM
comp.lang.c++.moderated 10738 articles. 1 followers. allnor (8509) is leader. Post Follow

2 Replies
431 Views

Similar Articles

[PageSpeed] 26

On 2016-02-16 14:03, Joe Bentley wrote:
>
> Is the <cstdlib> header file required?  I have noticed that in some
> implementations it appears to be automatically included.  Maybe it's
picked
> up by <iostream> or some other common header file, but I can't find any
> reference on this.  Does the "standard" have anything to say on its
> inclusion by other header files?
>
>

You should include the headers of the things you use. That's the simple 
rule.

The standard says that any C++ header may include any other C++ header, 
as needed. Relying on one header including some other header makes your 
code non-portable, as the next compiler might include another set of 
headers.

For <iostream> in particular, the standard makes an exception and 
explicitly requires these includes:

#include <ios>
#include <streambuf>
#include <istream>
#include <ostream>

Whether any of those in turn includes <cstdlib> is not specified.



     Bo Persson


-- 
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

0
Bo
2/16/2016 12:32:26 PM
Bo Persson <bop@gmb.dk> writes in the comp.lang.c++.moderated:
>For <iostream> in particular, the standard makes an exception and 
>explicitly requires these includes:
>#include <ios>

  There seem to be other such inclusions too:

utility -> initializer_list
bitset -> string, iosfwd
string -> initializier_list
array -> initializier_list
....


0
ram
2/19/2016 3:20:14 AM
Reply:

Similar Artilces:

SOLn TO P=NP
My mining engineer brother keeps asking me to work out how to optimise his Mine Pit Truck Loading Schedule.. a classic Travelling Salesman Problem. This is a Practical Solution only for improved results, not finding a single needle in a haystack. ---------------------------- This looks like a good solution to your mine pit scheduling problem. When I get some time I'll see if I can get it running, or you can probably test it out yourself. Remember you showed me your Sim Anneal of 20 cities by swapping the letters. <a b c d e f g h i j k l m n o p q r s t > HIGH TEMP - swap a...

WA - Bellevue Mainframe Developer Assembler CLIST C/C++ ISPF
Location: Bellevue, Washington Position: Senior Engineer, Mainframe Development Type: Full Time Salary: $95k -$105k ( Lets Talk) Job ID = MF-032604- Apply Here: http://www.recruitingpoint.com/corp/jobboard/jobdetails.asp?jobid=105 You must be eligible to work in the USA for any employer. THIS IS NOT CONTRACT OR TELECOMMUTE POSITION You will be a key member of the product development team. As a senior member of their development team, this person will have a fundamental impact on the architecture and strategy for their Storage Resource Management product. You M...

WA - Bellevue Mainframe Developer Assembler CLIST C/C++ ISPF
Location: Bellevue, Washington Position: Senior Engineer, Mainframe Development Type: Full Time Salary: $95k -$105k ( Lets Talk) Job ID = MF-032604- Apply Here: http://www.recruitingpoint.com/corp/jobboard/jobdetails.asp?jobid=105 You must be eligible to work in the USA for any employer. THIS IS NOT CONTRACT OR TELECOMMUTE POSITION You will be a key member of the product development team. As a senior member of their development team, this person will have a fundamental impact on the architecture and strategy for their Storage Resource Management product. You MUST HAVE 95 % of t...

<<<<<<<<<<<<<The Real A.I PROBLEMS">>>>>>>>>>>>>>>>>>>>>>>>>>>
The unvierse is like a ballon with black holes and white holes picture two on each side left two right on upside down the speed and the amout of matter consumed is a direct relations ship two the size of the ballon as the ballon get bigger the gravitaion forces of the black holes increase two self balance the universe it's self fixing but as time go's on and matter moves at diffrent speed's in diffrent dementions and at diffrent rates the demnetions become unstable becasue of misplaced matter ( magnetic plasma hint hint" oppset of black matter. ( sun spots ) why is the...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** Hi! > You too can learn to be funny in just 7 days flat: ....spamming newsgroups, though, just ISN'T funny. Even this newsgroup... Path: attbi_s22!attbi_s21!attbi_slave12!attbi_master11!wn14feed!worldnet.att.net!1 99.218.7.141!news.glorb.com!newsfeed-east.nntpserver.com!nntpserver.com!stat ler.nntpserver.com!hydra.nntpserver.com!not-for-mail From:...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** Expert Spammer wrote: > You too can learn to be funny in just 7 days flat: That's funny, I saw these exact same posts on other newsgroups. ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%> #2
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%> #2
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%> #5
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%> #2
You too can learn to be funny in just 7 days flat: http://www.ExpertHumor.com/HowToBeFunny.htm *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

Web resources about - Is <cstdlib> required? - comp.lang.c++.moderated

Resources last updated: 2/19/2016 5:04:30 AM