ramosian-glider wrote:

> Yeah! you are right that the size depends on the variable, but I never said 
> to create a variable.
> Suppose I have two functions performing same process but one is returning 
> bool and other one is returning int.
>
> 1. bool fnc1() { return (_Bool)true; }
> 2. int fnc2(){ return true; }
>
> Can you please tell me which of the above 2 function will be more efficient?

Again, in this case the "efficiency" of these functions does not depend on how 
you declare true and false, but rather on what return type each function has.

But the impact of type change is also questionable. Per modern calling 
conventions, the return value of a function is stored in a CPU register, and 
the size of that register is usually 4 or 8 bytes. Even if one decides to 
return a 1-byte value, there won't be much difference for the CPU. (Well, on 
x86 you can return the 1-byte value in AL, but this won't lead to faster code).

> If this is also the case with Clang, then my work is done here.

Yes, this is also the case.

https://github.com/llvm/llvm-project/pull/138713
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to