{"id":293771,"date":"2019-08-23T15:01:17","date_gmt":"2019-08-23T15:01:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=293771"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=293771","title":{"rendered":"\u041f\u043e\u0447\u0435\u043c\u0443 const \u043d\u0435 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u043a\u043e\u0434 \u043d\u0430 \u0421\/C++?"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ck\/cw\/48\/ckcw48o0aqklzf10gzhfqx8w3rw.jpeg\"><\/div>\n<p>  \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434 \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435, \u0447\u0442\u043e <a href=\"https:\/\/theartofmachinery.com\/2019\/04\/05\/d_as_c_replacement.html#const-and-immutable\">\u044d\u0442\u043e \u043c\u0438\u0444, \u0431\u0443\u0434\u0442\u043e \u0431\u044b const \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0432 C \u0438 C++<\/a>. \u042f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u044f \u0441\u0430\u043c \u0432\u0435\u0440\u0438\u043b \u0432 \u044d\u0442\u043e\u0442 \u043c\u0438\u0444. \u041d\u0430\u0447\u043d\u0443 \u0441 \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0434\u0443 \u043a \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043c \u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u2014 SQLite.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u0441\u0442<\/h2>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043d\u0430 \u0421 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>const<\/code>. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"cpp\">void func(int *x); void constFunc(const int *x);<\/code><\/pre>\n<p>  \u0418, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">void byArg(int *x) {   printf(\"%d\\n\", *x);   func(x);   printf(\"%d\\n\", *x); }  void constByArg(const int *x) {   printf(\"%d\\n\", *x);   constFunc(x);   printf(\"%d\\n\", *x); }<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <code>printf()<\/code>, \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>*x<\/code>. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 <code>constByArg()<\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0435\u0433\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c\u0441\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e <code>*x<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442 \u043d\u0443\u0436\u0434\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0435\u0451 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043d\u043e\u0432\u0430, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0430 <code>constFunc()<\/code>. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 GCC \u0441\u043e \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u043c\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"bash\">$ gcc -S -Wall -O3 test.c $ view test.s<\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435 \u0434\u043b\u044f <code>byArg()<\/code>:<\/p>\n<pre><code class=\"plaintext\">byArg: .LFB23:     .cfi_startproc     pushq   %rbx     .cfi_def_cfa_offset 16     .cfi_offset 3, -16     movl    (%rdi), %edx     movq    %rdi, %rbx     leaq    .LC0(%rip), %rsi     movl    $1, %edi     xorl    %eax, %eax     call    __printf_chk@PLT     movq    %rbx, %rdi     call    func@PLT  # The only instruction that's different in constFoo     movl    (%rbx), %edx     leaq    .LC0(%rip), %rsi     xorl    %eax, %eax     movl    $1, %edi     popq    %rbx     .cfi_def_cfa_offset 8     jmp __printf_chk@PLT     .cfi_endproc<\/code><\/pre>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0434\u043b\u044f <code>byArg()<\/code> \u0438 <code>constByArg()<\/code>, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 <code>constByArg()<\/code> \u0435\u0441\u0442\u044c <code>call constFunc@PLT<\/code>, \u043a\u0430\u043a \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435. \u0421\u0430\u043c <code>const<\/code> \u043d\u0435 \u043f\u0440\u0438\u0432\u043d\u043e\u0441\u0438\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439.<\/p>\n<p>  \u041b\u0430\u0434\u043d\u043e, \u044d\u0442\u043e \u0431\u044b\u043b GCC. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u043e\u0443\u043c\u043d\u0435\u0435. \u0421\u043a\u0430\u0436\u0435\u043c, Clang.<\/p>\n<pre><code class=\"cpp\">$ clang -S -Wall -O3 -emit-llvm test.c $ view test.ll<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434. \u041e\u043d \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0435\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430, \u0438 \u044f \u043e\u0442\u0431\u0440\u043e\u0448\u0443 \u043e\u0431\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u0430\u043c \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0447\u0442\u043e \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u043f\u043e\u0434 \u00ab\u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0430\u00bb:<\/p>\n<pre><code class=\"cpp\">; Function Attrs: nounwind uwtable define dso_local void @byArg(i32*) local_unnamed_addr #0 {   %2 = load i32, i32* %0, align 4, !tbaa !2   %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)   tail call void @func(i32* %0) #4   %4 = load i32, i32* %0, align 4, !tbaa !2   %5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)   ret void }  ; Function Attrs: nounwind uwtable define dso_local void @constByArg(i32*) local_unnamed_addr #0 {   %2 = load i32, i32* %0, align 4, !tbaa !2   %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)   tail call void @constFunc(i32* %0) #4   %4 = load i32, i32* %0, align 4, !tbaa !2   %5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)   ret void }<\/code><\/pre>\n<p>  <\/p>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 (\u0442\u0438\u043f\u0430) \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h2>\n<p>  \u0410 \u0432\u043e\u0442 \u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 <code>const<\/code> \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"cpp\">void localVar() {   int x = 42;   printf(\"%d\\n\", x);   constFunc(&amp;x);   printf(\"%d\\n\", x); }  void constLocalVar() {   const int x = 42;  \/\/ const on the local variable   printf(\"%d\\n\", x);   constFunc(&amp;x);   printf(\"%d\\n\", x); }<\/code><\/pre>\n<p>  \u0410\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f <code>localVar()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0432\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 <code>constLocalVar()<\/code>:<\/p>\n<pre><code class=\"cpp\">localVar:  .LFB25:     .cfi_startproc     subq    $24, %rsp     .cfi_def_cfa_offset 32     movl    $42, %edx     movl    $1, %edi     movq    %fs:40, %rax     movq    %rax, 8(%rsp)     xorl    %eax, %eax     leaq    .LC0(%rip), %rsi     movl    $42, 4(%rsp)     call    __printf_chk@PLT     leaq    4(%rsp), %rdi     call    constFunc@PLT     movl    4(%rsp), %edx  # not in constLocalVar()     xorl    %eax, %eax     movl    $1, %edi     leaq    .LC0(%rip), %rsi  # not in constLocalVar()     call    __printf_chk@PLT     movq    8(%rsp), %rax     xorq    %fs:40, %rax     jne .L9     addq    $24, %rsp     .cfi_remember_state     .cfi_def_cfa_offset 8     ret .L9:     .cfi_restore_state     call    __stack_chk_fail@PLT     .cfi_endproc<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 LLVM \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0447\u0438\u0449\u0435. <code>load<\/code> \u043f\u0435\u0440\u0435\u0434 \u0432\u0442\u043e\u0440\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c <code>printf()<\/code> \u0431\u044b\u043b\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 <code>constLocalVar()<\/code>:<\/p>\n<pre><code class=\"cpp\">; Function Attrs: nounwind uwtable define dso_local void @localVar() local_unnamed_addr #0 {   %1 = alloca i32, align 4   %2 = bitcast i32* %1 to i8*   call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2) #4   store i32 42, i32* %1, align 4, !tbaa !2   %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42)   call void @constFunc(i32* nonnull %1) #4   %4 = load i32, i32* %1, align 4, !tbaa !2   %5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)   call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2) #4   ret void }<\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, <code>constLocalVar()<\/code> \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 <code>*x<\/code>, \u043d\u043e \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0435: \u0432 \u0442\u0435\u043b\u0430\u0445 <code>localVar()<\/code> \u0438 <code>constLocalVar()<\/code>\u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0432\u044b\u0437\u043e\u0432 <code>constFunc()<\/code>. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c, \u0447\u0442\u043e <code>constFunc()<\/code> \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b\u0430 <code>*x<\/code> \u0432 <code>constLocalVar()<\/code>, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b <code>*x<\/code> \u0432 <code>localVar()<\/code>?<\/p>\n<p>  \u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 <code>const<\/code> \u0432 \u0421 \u043d\u0435\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 C \u0443 <code>const<\/code> \u0435\u0441\u0442\u044c, \u043f\u043e \u0441\u0443\u0442\u0438, \u0434\u0432\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u043c\u044b\u0441\u043b\u0430: <\/p>\n<ul>\n<li>\u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u2014 \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439, \u0430 \u043c\u043e\u0433\u0443\u0442 \u0438 \u043d\u0435 \u0431\u044b\u0442\u044c.  <\/li>\n<li>\u043b\u0438\u0431\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439. \u0415\u0441\u043b\u0438 \u0432\u044b \u043e\u0442\u0432\u044f\u0436\u0435\u0442\u0435 <code>const<\/code> \u043e\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u0432 \u043d\u0435\u0451, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 <code>const<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0449\u0435\u0435\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439.  <\/li>\n<\/ul>\n<p>  \u0412\u043e\u0442 \u043f\u043e\u044f\u0441\u043d\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>constFunc()<\/code>:<\/p>\n<pre><code class=\"cpp\">\/\/ x is just a read-only pointer to something that may or may not be a constant void constFunc(const int *x) {   \/\/ local_var is a true constant   const int local_var = 42;    \/\/ Definitely undefined behaviour by C rules   doubleIt((int*)&amp;local_var);   \/\/ Who knows if this is UB?   doubleIt((int*)x); }  void doubleIt(int *x) {   *x *= 2; } <\/code><\/pre>\n<p>  <code>localVar()<\/code> \u0434\u0430\u043b\u0430 <code>constFunc()<\/code> \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <code>const<\/code> \u043d\u0430 \u043d\u0435-<code>const<\/code> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u0431\u044b\u043b\u0430 <code>const<\/code>, \u0442\u043e <code>constFunc()<\/code> \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043b\u0436\u0435\u0446\u043e\u043c \u0438 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0431\u0435\u0437 \u0438\u0446\u0438\u0446\u0438\u0430\u0446\u0438\u0438 UB. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f <code>constFunc()<\/code> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432 <code>constLocalVar()<\/code> \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>const<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043e\u043d\u0430 <i>\u0431\u0443\u0434\u0435\u0442<\/i> UB \u0434\u043b\u044f <code>constFunc()<\/code>, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043e\u0442\u0432\u044f\u0437\u0430\u043b <code>const<\/code> \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u043b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e.<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u0438 <code>byArg()<\/code> \u0438 <code>constByArg()<\/code> \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0435\u0437\u043d\u0430\u0434\u0451\u0436\u043d\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 <code>*x<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>const<\/code>.<\/p>\n<p>  \u041d\u043e \u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u0430\u0441\u044c \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c? \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e <code>constFunc()<\/code> \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0431\u0443\u0434\u0443\u0447\u0438 \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u043e\u0439 \u0438\u0437 <code>constLocalVar()<\/code>, \u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0442\u0435 \u0436\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043a \u0432\u044b\u0437\u043e\u0432\u0430\u043c <code>constFunc()<\/code>, \u0432\u0435\u0440\u043d\u043e? \u041d\u0435\u0442. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e <code>constLocalVar()<\/code> \u0432\u043e\u043e\u0431\u0449\u0435 \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430. \u0418 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u0434\u0430 \u0438\u043b\u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u0430), \u0442\u043e <code>constFunc()<\/code> \u043c\u043e\u0436\u0435\u0442 \u0432\u0442\u0438\u0445\u0443\u044e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0432 UB.<\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435. \u041d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0432\u0443\u0447\u0438\u0442 \u0430\u0431\u0441\u0443\u0440\u0434\u043d\u043e \u2014 \u0442\u0430\u043a \u0438 \u0435\u0441\u0442\u044c. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <code>const<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u0443\u0434\u0448\u0435\u0439 \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c\u044e UB: \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e UB. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u0438\u0434\u0438\u0442 <code>const<\/code>, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0438\u0437 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u0433\u0434\u0435-\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>const<\/code> \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u043e \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435\u043c\u0430\u043b\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u0421 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0442\u043a\u0430\u0437 \u043e\u0442 <code>const<\/code> \u0432 \u0441\u0442\u0438\u043b\u0435 \u00ab\u044f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u00bb.<\/p>\n<p>  \u041a\u043e\u0440\u043e\u0447\u0435, \u0431\u044b\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u043d\u0435 \u0434\u0430\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>const<\/code> \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0438\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u0443\u0447\u0435 (heap). \u0418\u043b\u0438 \u0442\u043e\u0433\u043e \u0445\u0443\u0436\u0435, \u043e\u0431\u044b\u0447\u043d\u043e \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>const<\/code>, \u044d\u0442\u043e \u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043b\u044e\u0431\u043e\u0439 \u0443\u0432\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0441\u0435\u0431\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0438 \u0431\u0435\u0437 <code>const<\/code> \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 <code>x<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439:<\/p>\n<pre><code class=\"cpp\">int x = 42, y = 0; printf(\"%d %d\\n\", x, y); y += x; printf(\"%d %d\\n\", x, y);<\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, <code>const<\/code> \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e:<\/p>\n<ol>\n<li>\u0417\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430 \u0437\u0430\u043a\u043e\u043d\u043d\u044b\u0445 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043e\u0442\u0432\u044f\u0437\u0430\u0442\u044c <code>const<\/code>.  <\/li>\n<li>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u0441\u0451-\u0440\u0430\u0432\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439.  <\/li>\n<\/ol>\n<p>  <\/p>\n<h2>C++<\/h2>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u043d\u0430 \u0421++, \u0442\u043e <code>const<\/code> \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0423 \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c <code>const<\/code> \u0438 \u043d\u0435-<code>const<\/code>-\u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435-<code>const<\/code> \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b (\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c, \u0430 \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">void foo(int *p) {   \/\/ Needs to do more copying of data }  void foo(const int *p) {   \/\/ Doesn't need defensive copies }  int main() {   const int x = 42;   \/\/ const-ness affects which overload gets called   foo(&amp;x);   return 0; }<\/code><\/pre>\n<p>  \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u044f \u043d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0421++-\u043a\u043e\u0434\u0435. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u044f\u0437\u044b\u043a\u043e\u043c.<\/p>\n<h2>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0441 SQLite3<\/h2>\n<p>  \u0425\u0432\u0430\u0442\u0438\u0442 \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u043d\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u041a\u0430\u043a\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 <code>const<\/code> \u043d\u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443? \u042f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0441 \u0411\u0414 SQLite (\u0432\u0435\u0440\u0441\u0438\u044f 3.30.0), \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e:<\/p>\n<ul>\n<li>\u0412 \u043d\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>const.<\/code><\/li>\n<li>\u042d\u0442\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0434\u043e\u0432\u0430\u044f \u0431\u0430\u0437\u0430 (\u0441\u0432\u044b\u0448\u0435 200 KLOC).  <\/li>\n<li>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0440\u044f\u0434 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0447\u0438\u0441\u0435\u043b \u0432 \u0434\u0430\u0442\u0443.  <\/li>\n<li>\u0415\u0451 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0443.  <\/li>\n<\/ul>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0430\u0432\u0442\u043e\u0440 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u0443\u0436\u0435 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b\u0438 \u0433\u043e\u0434\u044b \u043d\u0430 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0433\u043e.<\/p>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h3>\n<p>  \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u0432\u0435 \u043a\u043e\u043f\u0438\u0438 <a href=\"https:\/\/sqlite.org\/src\/doc\/trunk\/README.md\">\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/a>. \u041e\u0434\u043d\u0443 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0430 \u0432\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0445\u0430\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c <code>const<\/code> \u0432 \u0445\u043e\u043b\u043e\u0441\u0442\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"cpp\">#define const<\/code><\/pre>\n<p>  (GNU) <code>sed<\/code> \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0440\u0445 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>sed -i '1i#define const' *.c *.h<\/code>.<\/p>\n<p>  SQLite \u0432\u0441\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044f \u043a\u043e\u0434 \u0432 \u0445\u043e\u0434\u0435 \u0441\u0431\u043e\u0440\u043a\u0438. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0432\u043d\u043e\u0441\u044f\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u0445 \u043f\u0440\u0438 \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u0441 <code>const<\/code> \u0438 \u0431\u0435\u0437 <code>const<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0435\u0433\u043e \u0430\u043d\u0442\u0438-<code>const<\/code> \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u041f\u0440\u044f\u043c\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u0435\u043b\u043a\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0432\u0441\u044e \u0441\u0445\u0435\u043c\u0443 \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u043e \u0432\u0441\u0451\u043c \u043a\u043e\u0434\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043d\u044f\u043b \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u0441\u043b\u0435\u043f\u043e\u043a (<code>objdump -d libSQLite3.so.0.8.6<\/code>) \u0432 \u0432\u0438\u0434\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0430 \u0438 \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">000000000005d570 &lt;SQLite3_blob_read&gt;:    5d570:       4c 8d 05 59 a2 ff ff    lea    -0x5da7(%rip),%r8        # 577d0 &lt;SQLite3BtreePayloadChecked&gt;    5d577:       e9 04 fe ff ff          jmpq   5d380 &lt;blobReadWrite&gt;    5d57c:       0f 1f 40 00             nopl   0x0(%rax)<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432:<\/p>\n<pre><code class=\"cpp\">SQLite3_blob_read   7lea 5jmpq 4nopl<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u044f \u043d\u0435 \u043c\u0435\u043d\u044f\u043b \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 SQLite.<\/p>\n<h3>\u0410\u043d\u0430\u043b\u0438\u0437 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/h3>\n<p>  \u0423 libSQLite3.so \u0432\u0435\u0440\u0441\u0438\u044f \u0441 <code>const<\/code> \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0430 4 740 704 \u0431\u0430\u0439\u0442\u043e\u0432, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 0,1 % \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0435\u0437 <code>const<\/code> \u0441 \u0435\u0451 4 736 712 \u0431\u0430\u0439\u0442\u0430\u043c\u0438. \u0412 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0431\u044b\u043b\u043e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e 1374 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044f \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 PLT), \u0438 \u0443 13 \u0431\u044b\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0432 \u0441\u043b\u0435\u043f\u043a\u0430\u0445.<\/p>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0445\u0430\u043a\u043e\u043c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432\u043e\u0442 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0438\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (\u044f \u0443\u0431\u0440\u0430\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0435 \u0434\u043b\u044f SQLite):<\/p>\n<pre><code class=\"cpp\">#define LARGEST_INT64  (0xffffffff|(((int64_t)0x7fffffff)&lt;&lt;32)) #define SMALLEST_INT64 (((int64_t)-1) - LARGEST_INT64)  static int64_t doubleToInt64(double r){   \/*   ** Many compilers we encounter do not define constants for the   ** minimum and maximum 64-bit integers, or they define them   ** inconsistently.  And many do not understand the \"LL\" notation.   ** So we define our own static constants here using nothing   ** larger than a 32-bit integer constant.   *\/   static const int64_t maxInt = LARGEST_INT64;   static const int64_t minInt = SMALLEST_INT64;    if( r&lt;=(double)minInt ){     return minInt;   }else if( r&gt;=(double)maxInt ){     return maxInt;    }else{     return (int64_t)r;   } }<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c <code>const<\/code>, \u0442\u043e \u044d\u0442\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432 <code>static<\/code>-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435. \u041d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0437\u0430\u0447\u0435\u043c \u043a\u043e\u043c\u0443-\u0442\u043e, \u043a\u043e\u0433\u043e \u043d\u0435 \u0432\u043e\u043b\u043d\u0443\u044e\u0442 <code>const<\/code>, \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <code>static<\/code>. \u0415\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0438 <code>static<\/code>, \u0438 <code>const<\/code>, \u0442\u043e GCC \u0441\u043d\u043e\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438, \u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0418\u0437-\u0437\u0430 \u0442\u0430\u043a\u0438\u0445 <code>static const<\/code> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0442\u0440\u0451\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0438\u0437 \u0442\u0440\u0438\u043d\u0430\u0434\u0446\u0430\u0442\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043b\u043e\u0436\u043d\u044b\u043c\u0438, \u043d\u043e \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u0438\u0445 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c.<\/p>\n<p>  SQLite \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0438 \u0441 \u044d\u0442\u0438\u043c \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0445 <code>const<\/code>-\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439: \u0432\u0440\u043e\u0434\u0435 \u0437\u0430\u043c\u0435\u043d\u044b \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439, \u0438\u043b\u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u0430\u0442\u0430 \u0446\u0438\u043a\u043b\u0430 \u043d\u0430 \u043e\u0434\u0438\u043d \u0448\u0430\u0433 (\u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0431\u044b\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <a href=\"https:\/\/rada.re\/r\/\">Radare<\/a>). \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u0441\u0442\u043e\u044f\u0442 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f. <code>SQLite3ParseUri()<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 487 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u043d\u043e <code>const<\/code> \u0432\u043d\u0451\u0441 \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435: \u0432\u0437\u044f\u043b \u044d\u0442\u0438 \u0434\u0432\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">test %al, %al je &lt;SQLite3ParseUri+0x717&gt; cmp $0x23, %al je &lt;SQLite3ParseUri+0x717&gt;<\/code><\/pre>\n<p>  \u0418 \u043f\u043e\u043c\u0435\u043d\u044f\u043b \u043c\u0435\u0441\u0442\u0430\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">cmp $0x23, %al je &lt;SQLite3ParseUri+0x717&gt; test %al, %al je &lt;SQLite3ParseUri+0x717&gt;<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438<\/h3>\n<p>  SQLite \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u044b\u043c \u0442\u0435\u0441\u0442\u043e\u043c \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0438 \u044f \u0441\u043e\u0442\u043d\u0438 \u0440\u0430\u0437 \u043f\u0440\u043e\u0433\u043d\u0430\u043b \u0435\u0433\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043e\u0434\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 SQLite. \u0414\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445:<\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<td><\/td>\n<td>const  <\/td>\n<td>\u0411\u0435\u0437 const  <\/td>\n<\/tr>\n<tr>\n<td>\u041c\u0438\u043d\u0438\u043c\u0443\u043c  <\/td>\n<td>10,658  <\/td>\n<td>10,803  <\/td>\n<\/tr>\n<tr>\n<td>\u041c\u0435\u0434\u0438\u0430\u043d\u0430  <\/td>\n<td>11,571  <\/td>\n<td>11,519  <\/td>\n<\/tr>\n<tr>\n<td>\u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c  <\/td>\n<td>11,832  <\/td>\n<td>11,658  <\/td>\n<\/tr>\n<tr>\n<td>\u0421\u0440\u0435\u0434\u043d\u0435\u0435  <\/td>\n<td>11,531  <\/td>\n<td>11,492  <\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  \u041b\u0438\u0447\u043d\u043e \u044f \u043d\u0435 \u0432\u0438\u0436\u0443 \u043e\u0441\u043e\u0431\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b. \u042f \u0443\u0431\u0440\u0430\u043b <code>const<\/code> \u0438\u0437\u043e \u0432\u0441\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u0431\u044b\u043b\u0430 \u0437\u0430\u043c\u0435\u0442\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430, \u0442\u043e \u0435\u0451 \u0431\u044b\u043b\u043e \u0431\u044b\u043b \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u0430\u0436\u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0442\u043e \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u043a\u0440\u043e\u0448\u0435\u0447\u043d\u043e\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437.<\/p>\n<p>  \u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0442\u0435\u0441\u0442 Mann-Whitney U. \u041e\u043d \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c\u0443 \u0442\u0435\u0441\u0442\u0443 t, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0430\u0445, \u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432 \u043a \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044f\u043c, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 (\u0438\u0437-\u0437\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0445 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0442.\u0434.). \u0412\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th><\/th>\n<th>const<\/th>\n<th>\u0411\u0435\u0437 const<\/th>\n<\/tr>\n<tr>\n<td>N<\/td>\n<td>100<\/td>\n<td>100<\/td>\n<\/tr>\n<tr>\n<td>\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f (Mean rank)<\/td>\n<td>121,38<\/td>\n<td>79,62<\/td>\n<\/tr>\n<tr>\n<td>Mann-Whitney U<\/td>\n<td><\/td>\n<td>2912<\/td>\n<\/tr>\n<tr>\n<td>Z<\/td>\n<td><\/td>\n<td>-5,10<\/td>\n<\/tr>\n<tr>\n<td>2-sided p value<\/td>\n<td><\/td>\n<td>&lt;10<sup>-6<\/sup>  <\/td>\n<\/tr>\n<tr>\n<td>\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 HL  <\/td>\n<td><\/td>\n<td>-0,056 \u0441.  <\/td>\n<\/tr>\n<tr>\n<td>95-\u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u044b\u0439 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b  <\/td>\n<td><\/td>\n<td>-0,077\u2026 -0,038 \u0441.  <\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  \u0422\u0435\u0441\u0442 U \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u043d\u0430\u0447\u0438\u043c\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u043e \u2014 \u0441\u044e\u0440\u043f\u0440\u0438\u0437! \u2014 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0432\u0435\u0440\u0441\u0438\u044f \u0431\u0435\u0437 <code>const<\/code>, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 60 \u043c\u0441, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 0,5 %. \u041f\u043e\u0445\u043e\u0436\u0435, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0445 \u00ab\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439\u00bb \u043d\u0435 \u0441\u0442\u043e\u0438\u043b\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430. \u0412\u0440\u044f\u0434 \u043b\u0438 <code>const<\/code> \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u0440\u043e\u0434\u0435 \u0430\u0432\u0442\u043e\u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0430\u0448 \u043f\u0440\u043e\u0431\u0435\u0433 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u043b\u0430\u0433\u043e\u0432 \u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435, \u0438\u043b\u0438 \u043e\u0442 \u0435\u0433\u043e \u0432\u0435\u0440\u0441\u0438\u0438, \u0438\u043b\u0438 \u043e\u0442 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b, \u0438\u043b\u0438 \u043e\u0442 \u0447\u0435\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0435\u0449\u0451. \u041d\u043e \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0431\u0443\u0434\u0435\u0442 \u0447\u0435\u0441\u0442\u043d\u044b\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0434\u0430\u0436\u0435 <code>const<\/code> \u043f\u043e\u0432\u044b\u0441\u0438\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c C, \u0442\u043e \u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b.<\/p>\n<h2>\u0422\u0430\u043a \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u0435\u043d const?<\/h2>\n<p>  \u041f\u0440\u0438 \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u0445, <code>const<\/code> \u0432 C\/C++ \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c <code>const<\/code> \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 move-\u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u043e\u0439 \u0438 <code>std::unique_pointer<\/code>, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044f\u0432\u043d\u043e\u0435 \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c. \u041d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0441\u0442\u044c \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u0431\u044b\u043b\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0432 \u0441\u0442\u0430\u0440\u044b\u0445 \u043a\u043e\u0434\u043e\u0432\u044b\u0445 \u0431\u0430\u0437\u0430\u0445 \u043d\u0430 \u0421++ \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0441\u0432\u044b\u0448\u0435 100 KLOC, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d <code>const<\/code> \u0437\u0430 \u0435\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u044f \u0432\u044b\u0445\u043e\u0434\u0438\u043b \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>const<\/code> \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u042f \u0441\u043b\u044b\u0448\u0430\u043b, \u0447\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c <code>const<\/code> \u0440\u0430\u0434\u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u042f \u0441\u043b\u044b\u0448\u0430\u043b, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u0430, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435 <code>const<\/code>, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043a\u043e\u0434 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043c\u0435\u043d\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u044d\u0442\u043e \u0437\u0432\u0443\u0447\u0430\u043b\u043e \u0440\u0430\u0437\u0443\u043c\u043d\u043e, \u043d\u043e \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440 \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0434\u0430.<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/464777\/\"> https:\/\/habr.com\/ru\/company\/mailru\/blog\/464777\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ck\/cw\/48\/ckcw48o0aqklzf10gzhfqx8w3rw.jpeg\"><\/div>\n<p>  \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434 \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435, \u0447\u0442\u043e <a href=\"https:\/\/theartofmachinery.com\/2019\/04\/05\/d_as_c_replacement.html#const-and-immutable\">\u044d\u0442\u043e \u043c\u0438\u0444, \u0431\u0443\u0434\u0442\u043e \u0431\u044b const \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0432 C \u0438 C++<\/a>. \u042f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u044f \u0441\u0430\u043c \u0432\u0435\u0440\u0438\u043b \u0432 \u044d\u0442\u043e\u0442 \u043c\u0438\u0444. \u041d\u0430\u0447\u043d\u0443 \u0441 \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0434\u0443 \u043a \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043c \u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u2014 SQLite.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-293771","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=293771"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293771\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=293771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=293771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=293771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}