bearophile Wrote:
>> (time ago I have suggested for a compile time flag that's defined inside 
>> functions to know if their result is used, to avoid computing it in some 
>> situations, turning the single function in a kind of templated function, but 
>> I am not sure it can work well if you have function pointers. So you need a 
>> single entry point for two functions).
> qwerty:
> > For a function without any side effects, it shouldn't be a problem.. I 
> > think :)
> 
> Ignoring the return value of a function without side effects (in D2 pure 
> functions or nothrow pure functions) has to be an error. I even have a bug 
> report for this, because it's the same situation as an expression like:
> a + 5;
> that the compiler sees as an error.
> 
I meant this:

function is with side effects --> normal func()
function is without side effect --> generate 2 version of the function
 *if compiler can see no return is required --> point to noReturnCalc version
  if compiler doesn't know --> point to returnCalc version
  if called through pointer --> point to returnCalc version 
As the function has no side effect, it doesn't matter there are two different 
versions (no static members etc.)

This will only speed up the *
Hope it makes any sense :D

Reply via email to