[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Invalid use of const pointer?

From: Joe Filion
Subject: Invalid use of const pointer?
Date: Fri, 7 Jan 2022 18:28:48 -0500



While examining the source code for make, I see something suspicious with a const pointer.


Line 3094 of read.c is:


char *userend = strchr (name + 1, '/');


The name parameter is a const pointer, so the overloaded version of strchr that takes a const pointer as the first parameter should also return a const pointer. But userend is not a const pointer and is used to modify the string later in the code. I’m a bit surprised the compiler allows this and I realize this could just be a misunderstanding of something on my part. Does anyone else find this construct suspicious?





Sent from Mail for Windows


reply via email to

[Prev in Thread] Current Thread [Next in Thread]