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,749 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All    |
|    Re: Keyword "innate" to allow compile ti    |
|    19 Dec 11 23:48:02    |
   
   9d219648   
   From: daniel.kruegler@googlemail.com   
      
   Am 19.12.2011 21:17, schrieb Stuart Heinrich:   
   > There is no reason why the output of a simple function like "sin(1.5)"   
   > that has no side effects cannot be precomputed during compilation --   
   > no reason, except that the compiler may not be able to detect the fact   
   > that this function has no side effects.   
   >   
   > I propose a simple keyword "innate" to resolve this issue. If a   
   > function is declared with keyword innate, and the function is called   
   > using inputs that are all compile time constants, then the output of   
   > the function should be guaranteed to be a compile time constant as   
   > well.   
   >   
   > Thus, if sin has been declared as an innate function, we can say:   
   >   
   > struct foo   
   > {   
   > static const int f = (int)(sin(1.5)*100);   
   > };   
   >   
   > and we still retain the ability to call "sin" dynamically as well.   
      
   Could you please point out what the difference is compared to a   
   constexpr function? (When saying so, I assume that a compiler-intrinsic   
   can be provided that provides this functionality).   
      
   Thanks & Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
    [ 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