home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,479 of 33,346   
   Miles Bader to ptyxs   
   Re: sqrt(a) with 'a' being an int   
   22 Sep 11 12:46:38   
   
   4255471e   
   From: miles@gnu.org   
      
   ptyxs  writes:   
   > #include    
   > #include    
   >   
   > int main()   
   > {   
   >     int a = 25;   
   >     std::cout << std::sqrt(a) << std::endl;   
   > }   
   >   
   > doesn't compile (as expected), and outputs the following error   
   > message :   
   >   
   > [toto@localhost ~]$ g++  -std=c++0x  -Wall -pedantic  sqrtmy3.cpp   
   > sqrtmy3.cpp: In function ‘int main()’:   
   > sqrtmy3.cpp:8:18: error: ‘sqrt’ is not a member of ‘std’   
   > sqrtmy3.cpp:8:18: note: suggested alternative:   
   > /usr/include/bits/mathcalls.h:157:1: note:   ‘sqrt’   
      
   You should say what version of g++ you have -- the above compiles   
   without error or warning with g++ versions 4.4 - 4.7, and with the   
   clang++ trunk version... (the most recent release version of clang++   
   doesn't support c++0x well enough).   
      
   -Miles   
      
   --   
   Future, n. That period of time in which our affairs prosper, our friends   
   are true and our happiness is assured.   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca