top | item 40295167

(no title)

josemanuel | 1 year ago

Are you thinking of "weak" rather than "inline"? I always thought of "inline" as a hint to the compiler -- the compiler can inline, but it may not, depending on some compiler-specific optimisation objective (execution speed, code size, ...).

discuss

order

tylerhou|1 year ago

No, I am not thinking of weak; this is why “inline does not mean inline” is on the iceberg :). Although practically speaking inline is also used as a hint. But chiefly it refers to inline linkage.

I’m actually also not familiar with weak, but a quick glance suggests that it might not mean the same thing as inline. Can weak symbols be defined multiple times? EDIT: yes, according to an SO post compilers often use weak to implement inline.

mgaunard|1 year ago

You thought wrong.

Marking the symbol as weak is what inline indeed does from a technical point of view.