Div() function



 DEVELOP > c-Plus-Plus > Div() function

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Schizoid Man"
Date: 29 Aug 2006 12:56:47 AM
Object: Div() function
Is Div() a standard C++ function with iostream or cmath? It seems to be
an incredibly useful function, and works well in Visual C++.
But I don't want to use to non-standard syntax for my project.
Thanks.
.

User: "Kai-Uwe Bux"

Title: Re: Div() function 29 Aug 2006 03:31:41 AM
Schizoid Man wrote:

Is Div() a standard C++ function with iostream or cmath?

No.

It seems to be an incredibly useful function, and works well in Visual
C++.

The headers <iostream> or <cmath> are allowed to import other headers: the
div() function is part of <cstdlib>.
Best
Kai-Uwe Bux
.
User: "Schizoid Man"

Title: Re: Div() function 29 Aug 2006 08:17:54 PM
Kai-Uwe Bux wrote:

Schizoid Man wrote:

Is Div() a standard C++ function with iostream or cmath?


No.


It seems to be an incredibly useful function, and works well in Visual
C++.


The headers <iostream> or <cmath> are allowed to import other headers: the
div() function is part of <cstdlib>.

Hi Kai,
Does <iostream> automatically import <cstdlib>? Because all I have is
<iostream> and <cmath>.
.
User: "Jack Klein"

Title: Re: Div() function 29 Aug 2006 09:50:14 PM
On Tue, 29 Aug 2006 18:17:54 -0700, Schizoid Man <schiz@sf.com> wrote
in comp.lang.c++:

Kai-Uwe Bux wrote:

Schizoid Man wrote:

Is Div() a standard C++ function with iostream or cmath?


No.


It seems to be an incredibly useful function, and works well in Visual
C++.


The headers <iostream> or <cmath> are allowed to import other headers: the
div() function is part of <cstdlib>.


Hi Kai,

Does <iostream> automatically import <cstdlib>? Because all I have is
<iostream> and <cmath>.

One of the changes from C to C++ is in the inclusion of standard
headers.
The C standard specifically prohibits any standard C header from
including any other standard C header.
The C++ standard specifically allows any standard C++ header,
including those inherited from C, to include any other standard C++
header.
So apparently on your particular implementation either <iostream> or
<cmath>, or both, include <cstdlib>. But your next compiler, or even
the next version of your current compiler, might not do so. For the
sake of portability don't count on it, and always implicitly include
every standard header whose types, objects, macros, or functions you
use.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.



User: "Schizoid Man"

Title: Re: Div() function 29 Aug 2006 02:56:49 AM
Schizoid Man wrote:

Is Div() a standard C++ function with iostream or cmath? It seems to be
an incredibly useful function, and works well in Visual C++.

But I don't want to use to non-standard syntax for my project.

I also meant to add that numerous Google searches haven't turned up
anything.
According to Cplusplus.com, div() is not a member of either <iostream>
or <cmath>. Yet, these are the only headers I am importing into the
class that uses this method.
MSDN has some literature, but I couldn't any references to it anywhere else.
Thanks.
.
User: "Colander"

Title: Re: Div() function 29 Aug 2006 03:47:02 AM
Schizoid Man wrote:

Schizoid Man wrote:

Is Div() a standard C++ function with iostream or cmath? It seems to be
an incredibly useful function, and works well in Visual C++.

But I don't want to use to non-standard syntax for my project.


I also meant to add that numerous Google searches haven't turned up
anything.

According to Cplusplus.com, div() is not a member of either <iostream>
or <cmath>. Yet, these are the only headers I am importing into the
class that uses this method.

MSDN has some literature, but I couldn't any references to it anywhere else.

It's in <cstdlib>
Here some (appropriate) text from the standard.....
26.5 C Library [lib.c.math]
Table 81-Header <cstdlib> synopsis
Functions:
abs labs srand
div ldiv rand
The added signatures are:
ldiv_t div(long, long); // ldiv()
colander
.



  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER