|
From: | Paul Eggert |
Subject: | bug#55895: [PATCH] maint: Fix ptr_align signature to silence -Wmaybe-uninitialized |
Date: | Sat, 11 Jun 2022 10:13:19 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
On 6/11/22 09:30, Anders Kaseorg wrote:
A pointer to uninitialized (or zero-initialized) memory that won’t be written is valid but not _useful_.
But in the example I gave, the memory *is* written to later.A const * pointer lets a C program have a read-only window into memory that other parts of the program can write to, which can be a useful thing to have. In C and C++, "const *" doesn't mean a pointer to storage that does not change; it merely means a pointer that can't be used to write the referenced storage.
[Prev in Thread] | Current Thread | [Next in Thread] |