<div dir="ltr">Thanks !</div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-09 11:46 GMT+02:00 Octavian Moraru <span dir="ltr"><<a href="mailto:octmoraru@gmail.com" target="_blank">octmoraru@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Salut Alex,<br>
<br>
2016-01-08 21:00 GMT+02:00 Alexandru Razvan Caciulescu via cpl<br>
<<a href="mailto:cpl@cursuri.cs.pub.ro">cpl@cursuri.cs.pub.ro</a>>:<br>
<span class="">> Intrebarea mea este daca se poate da un exemplu de test (macar partial) in<br>
> care acele array-uri global.ctors si global.dtors nu sunt vide si vor fi<br>
> populate pentru a putea testa ?<br>
<br>
</span>Pentru a genera un astfel de exemplu, este de ajuns să incluzi <iostream>:<br>
<br>
$ cat test.cpp<br>
#include <iostream><br>
<br>
int main()<br>
{<br>
std::cout << "Hello, global_ctors!";<br>
return 0;<br>
}<br>
<br>
$ clang -o test.bc -c -emit-llvm test.cpp<br>
$ llvm-dis < test.bc | grep global_ctors<br>
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{<br>
i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_test.cpp,<br>
i8* null }]<br>
<br>
Explicația o poți citi aici [1].<br>
<br>
Destructorul pe care îl vei adăuga la partea a doua a concursului este<br>
de asemenea un candidat bun pentru testare.<br>
<br>
[1] <a href="http://llvm.org/docs/FAQ.html#what-is-this-llvm-global-ctors-and-global-i-a-stuff-that-happens-when-i-include-iostream" rel="noreferrer" target="_blank">http://llvm.org/docs/FAQ.html#what-is-this-llvm-global-ctors-and-global-i-a-stuff-that-happens-when-i-include-iostream</a><br>
</blockquote></div><br></div>