Is there a compile flag that turns off - chewing off duplicate code?

I know the compiler is very smart, and it chews up function code that are
duplicate ( just different name).

Is there a way to turn this off ?

-pro

I think the term you want to search for is “COMDAT folding”.

d

debt from my phone


From: Prokash Sinha
Sent: 2/24/2012 12:44 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is there a compile flag that turns off - chewing off duplicate code?

I know the compiler is very smart, and it chews up function code that are duplicate ( just different name).

Is there a way to turn this off ?

-pro


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

In sources:

LINKER_NOICF=1

Thanks Doron.

-pro

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Friday, February 24, 2012 12:52 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Is there a compile flag that turns off - chewing off
duplicate code?

I think the term you want to search for is “COMDAT folding”.

d

debt from my phone


From: Prokash Sinha
Sent: 2/24/2012 12:44 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is there a compile flag that turns off - chewing off
duplicate code?

I know the compiler is very smart, and it chews up function code that are
duplicate ( just different name).

Is there a way to turn this off ?

-pro


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

The reason for this deals with instantiation of C++ templates, where each
instantiation generates duplicate code. But at the instruction level, the
code does not care if is manipulating a FOO* or a BAR*, so the classic
C++ problem is artificial code bloat. But for C code, it is somewhat less
useful, but, depending on your programming style, actually CAN make a
difference in the size of the code. So be selective when disabling this
feature.
joe

I know the compiler is very smart, and it chews up function code that are
duplicate ( just different name).

Is there a way to turn this off ?

-pro


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Yep, now I’m a tad bit more “Literate Programmer”, right after Doron pointed me to look at COMDAT.

Raymond Chen has a nice blog 'bout it. And that tells I did not yet finish readin his ebook on my kindle :slight_smile:

Short, crisp, and very thoughtful. I wish I knew some of it 15 yrs ago - “Default answer to a DialogBox - is Cancel”. And an account for the expenses of putting extra bytes into the code.

True master piece :slight_smile:

-pro

On Feb 25, 2012, at 2:03 AM, xxxxx@flounder.com wrote:

The reason for this deals with instantiation of C++ templates, where each
instantiation generates duplicate code. But at the instruction level, the
code does not care if is manipulating a FOO* or a BAR*, so the classic
C++ problem is artificial code bloat. But for C code, it is somewhat less
useful, but, depending on your programming style, actually CAN make a
difference in the size of the code. So be selective when disabling this
feature.
joe

> I know the compiler is very smart, and it chews up function code that are
> duplicate ( just different name).
>
>
>
> Is there a way to turn this off ?
>
>
>
> -pro
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Joe,

ICF is a problem when you’re debugging code and want to set a breakpoint in a short simple function. It could be a stub virtual function, or a stub callback. With ICF, the breakpoint will affect all different functions producing the same code (or the same lack of code).

I understand, because it has happened to me, and I nave several slides in
my “Debuggibg optimized code” course that adress pecisely this issue.
Inlining is another problem; either the debugger can’t find the function
at all, or the function is inlined in nealy all places and thus the place
with the breakpoint is never called. I was simply pointing out that for
special purposes ( e.g., debugging) it can make sense to diasable such
features, they should not just be blanket-disabled at all times.
joe

Joe,

ICF is a problem when you’re debugging code and want to set a breakpoint
in a short simple function. It could be a stub virtual function, or a stub
callback. With ICF, the breakpoint will affect all different functions
producing the same code (or the same lack of code).


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer