@SafeVarargs
Is a cure for the warning: [unchecked] Possible heap pollution from parameterized vararg type Foo.
Is part of the method's contract, hence why the annotation has runtime retention.
Is a promise to the caller of the method that the method will not mess up the heap using the generic varargs argument.
This article sheds light on how warnings work in GCC, why some warnings are false, and when warnings might not be output. Also discussed are the trade-offs made when implementing checks in GCC.
Turning procedural and structural knowledge into programs has established methodologies, but what about turning knowledge into probabilistic models? I explore a few examples of what such a process could look like.
As of this writing (but perhaps not for very much longer!) the four mainstream compilers on Godbolt Compiler Explorer give four different answers for this simple C++ program:
M. Chevalier-Boisvert, и M. Feeley. 30th European Conference on Object-Oriented Programming (ECOOP 2016), том 56 из Leibniz International Proceedings in Informatics (LIPIcs), стр. 7:1--7:24. Dagstuhl, Germany, Schloss Dagstuhl--Leibniz-Zentrum fuer Informatik, (2016)
H. Santos, P. Alves, I. Costa, и F. Quintao Pereira. Proceedings of the 2013 IEEE/ACM International Symposium on Code Generation and Optimization (CGO), стр. 1--11. IEEE Computer Society, (2013)
V. Ureche, C. Talau, и M. Odersky. Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages &\#38; Applications, стр. 73--92. ACM, (2013)
S. Ryu, и N. Ramsey. Compiler Construction: 14th International Conference, CC 2005, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2005, Edinburgh, UK, April 4-8, 2005. Proceedings, стр. 10--26. Springer, (2005)
G. Chari, D. Garbervetsky, и S. Marr. Proceedings of the 11th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems, стр. 5. (19.06.2017)