Click here to Skip to main content
15,889,096 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: *cries in C++* Pin
charlieg17-Feb-22 11:38
charlieg17-Feb-22 11:38 
GeneralRe: *cries in C++* Pin
honey the codewitch17-Feb-22 11:42
mvahoney the codewitch17-Feb-22 11:42 
GeneralRe: *cries in C++* Pin
charlieg17-Feb-22 11:48
charlieg17-Feb-22 11:48 
GeneralRe: *cries in C++* Pin
honey the codewitch17-Feb-22 12:04
mvahoney the codewitch17-Feb-22 12:04 
GeneralRe: *cries in C++* Pin
jschell17-Feb-22 11:54
jschell17-Feb-22 11:54 
GeneralRe: *cries in C++* Pin
honey the codewitch17-Feb-22 11:56
mvahoney the codewitch17-Feb-22 11:56 
GeneralRe: *cries in C++* Pin
bmarstella17-Feb-22 16:33
bmarstella17-Feb-22 16:33 
GeneralRe: *cries in C++* Pin
honey the codewitch17-Feb-22 16:45
mvahoney the codewitch17-Feb-22 16:45 
Yeah, but that's not what I was talking about.

More I'm talking about things like this.

C++
if(pin_d1>31) {
    b |= (((pins_h>>((pin_d1-32)&31))&1)<<1);
} else if(pin_d1>-1) {
    b |= (((pins_l>>(pin_d1))&1)<<1);
}
if(pin_d2>31) {
    b |= (((pins_h>>((pin_d2-32)&31))&1)<<2);
} else if(pin_d2>-1) {
    b |= (((pins_l>>(pin_d2))&1)<<2);
}
if(pin_d3>31) {
    b |= (((pins_h>>((pin_d3-32)&31))&1)<<3);
} else if(pin_d3>-1) {
    b |= (((pins_l>>(pin_d3))&1)<<3);
}
if(pin_d4>31) {
    b |= (((pins_h>>((pin_d4-32)&31))&1)<<4);
} else if(pin_d4>-1) {
    b |= (((pins_l>>((pin_d4)&31))&1)<<4);
}
if(pin_d5>31) {
    b |= (((pins_h>>((pin_d5-32)&31))&1)<<5);
} else if(pin_d5>-1) {
    b |= (((pins_l>>(pin_d5))&1)<<5);
}
if(pin_d6>31) {
    b |= (((pins_h>>((pin_d6-32)&31))&1)<<6);
} else if(pin_d6>-1) {
    b |= (((pins_l>>(pin_d6))&1)<<6);
}
if(pin_d7>31) {
    b |= (((pins_h>>((pin_d7-32)&31))&1)<<7);
} else if(pin_d7>-1) {
    b |= (((pins_l>>(pin_d7))&1)<<7);
}


How many of these if statements will be compiled into the binary?

You can't know that just by looking at it, assuming this is C++.

In this case, none will, because they all evaluate constexpr values.

But those can be buried under templates, for example, and then the answer non-obvious.
Real programmers use butterflies

GeneralRe: *cries in C++* Pin
Stefan_Lang19-Feb-22 2:21
Stefan_Lang19-Feb-22 2:21 
GeneralRe: *cries in C++* Pin
honey the codewitch19-Feb-22 4:55
mvahoney the codewitch19-Feb-22 4:55 
GeneralOh boy. I've given myself a challenge now. Pin
OriginalGriff16-Feb-22 1:48
mveOriginalGriff16-Feb-22 1:48 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
honey the codewitch16-Feb-22 1:53
mvahoney the codewitch16-Feb-22 1:53 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
Peter_in_278016-Feb-22 1:58
professionalPeter_in_278016-Feb-22 1:58 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
Dave Kreskowiak16-Feb-22 2:08
mveDave Kreskowiak16-Feb-22 2:08 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
Amarnath S16-Feb-22 2:15
professionalAmarnath S16-Feb-22 2:15 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
Richard MacCutchan16-Feb-22 2:32
mveRichard MacCutchan16-Feb-22 2:32 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
craig robbins MN16-Feb-22 2:59
craig robbins MN16-Feb-22 2:59 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
dan!sh 16-Feb-22 3:06
professional dan!sh 16-Feb-22 3:06 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
PIEBALDconsult16-Feb-22 3:06
mvePIEBALDconsult16-Feb-22 3:06 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
kmoorevs16-Feb-22 3:50
kmoorevs16-Feb-22 3:50 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
Matias Lopez16-Feb-22 4:05
Matias Lopez16-Feb-22 4:05 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
Matthew Dennis16-Feb-22 4:21
sysadminMatthew Dennis16-Feb-22 4:21 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
OriginalGriff16-Feb-22 4:56
mveOriginalGriff16-Feb-22 4:56 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
DRHuff16-Feb-22 4:51
DRHuff16-Feb-22 4:51 
GeneralRe: Oh boy. I've given myself a challenge now. Pin
k505416-Feb-22 5:12
mvek505416-Feb-22 5:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.