822
you are viewing a single comment's thread
view the rest of the comments
[-] xep@fedia.io 41 points 2 days ago

The WTF case isn't allowed because it would allow modification of the const. From https://en.cppreference.com/w/cpp/language/implicit_conversion

int main() { const char c = 'c'; char* pc; char** ppc = &pc; const char** pcc = ppc; // Error: not the same as cv-unqualified char**, no implicit conversion. *pcc = &c; *pc = 'C'; // If the erroneous assignment above is allowed, the const object “c” may be modified. }

this post was submitted on 08 Jan 2025
822 points (98.0% liked)

Programmer Humor

19910 readers
2081 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS