Liste des Groupes | Revenir à cl c |
On 31/10/2024 12:11, fir wrote:std::unreachable();somethins i got such pices of code likeWhy not ...
>
if(n==1) {/*something/}
if(n==2) {/*something/}
if(n==3) {/*something/}
if(n==4) {/*something/}
if(n==5) {/*something/}
>
technically i would need to add elses - but the question is if to do that
switch (n)
{
case 1:
/* something */
break;
case 2:
/* etc ... */
default:
/* something else */
}
... ?
>The size of teh [sic] source code won't make any difference to the size of the executable - so aim for readability first and foremost.
do teh code has really chance to be slower without else (except some very prmitive compilers) ??
>
not adding else makes liek code shorter.. so im not literally sure which is better
Les messages affichés proviennent d'usenet.