Click here to Skip to main content
15,886,110 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: spiderman, spiderverse, blahblahblah... Pin
Super Lloyd18-Feb-22 0:17
Super Lloyd18-Feb-22 0:17 
GeneralRe: spiderman, spiderverse, blahblahblah... Pin
OriginalGriff18-Feb-22 0:30
mveOriginalGriff18-Feb-22 0:30 
GeneralRe: spiderman, spiderverse, blahblahblah... Pin
Super Lloyd18-Feb-22 1:47
Super Lloyd18-Feb-22 1:47 
GeneralRe: spiderman, spiderverse, blahblahblah... Pin
Super Lloyd18-Feb-22 1:50
Super Lloyd18-Feb-22 1:50 
GeneralRe: spiderman, spiderverse, blahblahblah... Pin
Slacker00718-Feb-22 1:31
professionalSlacker00718-Feb-22 1:31 
GeneralRe: spiderman, spiderverse, blahblahblah... Pin
Super Lloyd18-Feb-22 1:48
Super Lloyd18-Feb-22 1:48 
GeneralRe: spiderman, spiderverse, blahblahblah... Pin
fgs196318-Feb-22 2:55
fgs196318-Feb-22 2:55 
GeneralThis code saved me a day of work - always check your information Pin
honey the codewitch17-Feb-22 22:11
mvahoney the codewitch17-Feb-22 22:11 
I've been told/read multiple times that GCC will always inline template functions.

I use a ton of template functions in GFX for drawing operations, and I was deeply concerned that for example, my line drawing code (contained in a template function) was getting replicated for every line draw.

So I was going to wrap the calls in template structs, and then forward the template function calls to those. That was going to take a lot of time to refactor.

so before I did, i fired up the trusty Compiler Explorer[^] and ran this code:

C++
#include <stdio.h>

template<int A,int B, int C> struct wrap {
    static void abc() {
        printf("A+B+C = %d\r\n",A+B+C);    
        printf("A+B+C = %d\r\n",A+B+C);    
        printf("A+B+C = %d\r\n",A+B+C);    
    }
};

template<int A,int B, int C> void abc() {
    //wrap<A,B,C>::abc();
    printf("A+B+C = %d\r\n",A+B+C);    
        printf("A+B+C = %d\r\n",A+B+C);    
        printf("A+B+C = %d\r\n",A+B+C);    
}

int main(int argc,char** argv) {
    abc<1,0,0>();
    abc<1,2,3>();
    abc<1,0,0>();
    abc<1,0,0>();
}


Come to find out, my information was bovine excrement. abc<1,0,0> does indeed get turned into a function, as long as the function is large enough.

Always
Check
Your
Assumptions

This has been a public service announcement.
Real programmers use butterflies

GeneralRe: This code saved me a day of work - always check your information Pin
lmoelleb17-Feb-22 22:22
lmoelleb17-Feb-22 22:22 
GeneralRe: This code saved me a day of work - always check your information Pin
honey the codewitch17-Feb-22 22:40
mvahoney the codewitch17-Feb-22 22:40 
GeneralRe: This code saved me a day of work - always check your information Pin
obermd18-Feb-22 3:53
obermd18-Feb-22 3:53 
GeneralRe: This code saved me a day of work - always check your information Pin
honey the codewitch18-Feb-22 3:57
mvahoney the codewitch18-Feb-22 3:57 
GeneralSound of the Week Pin
Sander Rossel17-Feb-22 21:49
professionalSander Rossel17-Feb-22 21:49 
GeneralRe: Sound of the Week Pin
craig robbins MN18-Feb-22 3:43
craig robbins MN18-Feb-22 3:43 
GeneralRe: Sound of the Week Pin
Sander Rossel18-Feb-22 21:26
professionalSander Rossel18-Feb-22 21:26 
GeneralRe: Sound of the Week Pin
David O'Neil18-Feb-22 4:50
professionalDavid O'Neil18-Feb-22 4:50 
GeneralRe: Sound of the Week Pin
Sander Rossel18-Feb-22 21:22
professionalSander Rossel18-Feb-22 21:22 
GeneralRe: Sound of the Week Pin
David O'Neil18-Feb-22 21:53
professionalDavid O'Neil18-Feb-22 21:53 
GeneralRe: Sound of the Week Pin
David O'Neil18-Feb-22 18:44
professionalDavid O'Neil18-Feb-22 18:44 
GeneralRe: Sound of the Week Pin
Sander Rossel18-Feb-22 21:20
professionalSander Rossel18-Feb-22 21:20 
GeneralARE YOU SCAMMERS? Pin
User 1550064617-Feb-22 21:21
User 1550064617-Feb-22 21:21 
GeneralNO, not as far as I can tell. Pin
OriginalGriff17-Feb-22 21:21
mveOriginalGriff17-Feb-22 21:21 
GeneralRe: NO, not as far as I can tell. Pin
den2k8817-Feb-22 21:48
professionalden2k8817-Feb-22 21:48 
GeneralRe: NO, not as far as I can tell. Pin
OriginalGriff17-Feb-22 21:54
mveOriginalGriff17-Feb-22 21:54 
GeneralRe: NO, not as far as I can tell. Pin
yacCarsten18-Feb-22 2:37
yacCarsten18-Feb-22 2:37 

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.