LINUX.ORG.RU

История изменений

Исправление snizovtsev, (текущая версия) :

clang 16.0: -Weverything:

<source>:6:10: warning: 'a' is an unsafe pointer used for buffer access [-Wunsafe-buffer-usage]
    int *a = new int [n];
    ~~~~~^~~~~~~~~~~~~~~
<source>:9:9: note: used in buffer access here
        a[i] = i;
        ^
<source>:14:22: note: used in buffer access here
        std::cout << a[i] << std::endl;

https://godbolt.org/z/qe9779Grq

Исходная версия snizovtsev, :

clang 13.0: -Weverything:

<source>:6:10: warning: 'a' is an unsafe pointer used for buffer access [-Wunsafe-buffer-usage]
    int *a = new int [n];
    ~~~~~^~~~~~~~~~~~~~~
<source>:9:9: note: used in buffer access here
        a[i] = i;
        ^
<source>:14:22: note: used in buffer access here
        std::cout << a[i] << std::endl;

https://godbolt.org/z/qe9779Grq