[DiscordArchive] Isnt calling a function from other TU odr-using it?
[DiscordArchive] Isnt calling a function from other TU odr-using it?
Archived author: Sovak • Posted: 2022-09-11T18:22:02.980000+00:00
Original source
Isnt calling a function from other TU odr-using it?
![[Image: unknown.png?ex=690c3eb4&is=690aed34&hm=f...2373db847&]](https://cdn.discordapp.com/attachments/376074396915335170/1018587416963076266/unknown.png?ex=690c3eb4&is=690aed34&hm=f60254db83af6497d5c26f653f24271818aa2553920d1d677855dc42373db847&)
Archived author: Sovak • Posted: 2022-09-11T18:22:44.689000+00:00
Original source
This is what I had in mind
![[Image: unknown.png?ex=690c3eb4&is=690aed34&hm=f...2373db847&]](https://cdn.discordapp.com/attachments/376074396915335170/1018587416963076266/unknown.png?ex=690c3eb4&is=690aed34&hm=f60254db83af6497d5c26f653f24271818aa2553920d1d677855dc42373db847&)
Archived author: <o> • Posted: 2022-09-11T18:22:50.399000+00:00
Original source
functions are not variables, and the odr section makes that distinction
Archived author: <o> • Posted: 2022-09-11T18:23:11.584000+00:00
Original source
but that could be an oversight in the phrasing
Archived author: Sovak • Posted: 2022-09-11T18:23:57.491000+00:00
Original source
it happens before the first odr-use of any variable with static/thread storage duration defined in the same translation unit as the variable to be initialized. If no variable or function is odr-used from a given translation unit, the non-local variables defined in that translation unit may never be initialized
Archived author: Sovak • Posted: 2022-09-11T18:24:11.948000+00:00
Original source
In the first sentence they say variable, in the second variable or function
Archived author: <o> • Posted: 2022-09-11T18:26:10.208000+00:00
Original source
classic
Archived author: Sovak • Posted: 2022-09-11T18:26:47.571000+00:00
Original source
Imo it must be a function as well, it might reference a static variable
Archived author: <o> • Posted: 2022-09-11T18:27:08.515000+00:00
Original source
yeah, but i think the whole point of that is that you can defer this to when that function actually references the variable
Archived author: <o> • Posted: 2022-09-11T18:27:24.225000+00:00
Original source
but when it does, it has to initialize them all