delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/30/03:30:43

Newsgroups: comp.os.msdos.djgpp
From: Michael Lehotay <michael DOT lehotay AT utoronto DOT ca>
Subject: Re: missing C++ header <limits>
X-Nntp-Posting-Host: hobbit.dialin.utoronto.ca
Message-ID: <3689D541.DF9346B9@utoronto.ca>
Sender: nntp AT campus-news-reading DOT utoronto DOT ca (News)
Organization: UTCC Campus Access
References: <368926D6 DOT ED264561 AT utoronto DOT ca> <36896116 DOT 3C39C3A1 AT earthlink DOT net>
Mime-Version: 1.0
Date: Wed, 30 Dec 1998 07:24:49 GMT
X-Mailer: Mozilla 4.06 [en] (Win95; U)
Lines: 36
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Martin Ambuhl wrote:
> 
> Michael Lehotay wrote:
> >
> > I've started to teach myself C++ from Stroustrup (3rd ed.), and I've run
> > into a problem: there is no <limits> header file. I realize I could use
> > <limits.h> instead, but what I really wanted was numeric_limits.
> 
> When there is a C header named <x.h>, the corresponding C++ header is
> called <cx>.  In this case, it is <climits>.
> 
> An unfortunate problem with BS's 3rd ed is a large number of errata,
> which are listing in several files at the wed site you can reach through
> the URL on the back cover of your book.

Let me rephrase my question. I cannot compile this code:

#include <limits>
int main() {
   cout << "largest int: " << numeric_limits<int>::max() << '\n';
   return 0;
}

The problem is that the <limits> header file, which supposedly defines
numeric_limits, seems to be missing. <climits> just #includes <limits.h>,
which only #defines limit macros. I could use these macros to do the same
thing, but my point is that I want to learn how to program in C++ instead
of just writing C code with the same functionality.

Am I correct in my assumption that I'll just have to live without
numeric_limits? If so, should I expect to run into more surprises like
this?

Thanks,
Michael

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019