can somebody please explain what does it mean :
passing arg 1 of 'free' discards qualifiers from pointer target type
can somebody please explain what does it mean : passing arg 1 of ‘free’
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I believe “discards qualifies” pertains to
constorvolatile. So you’re probably passing a const pointer as a non-const argument.You code probably resembles the following:
I borrowed this example from a similar question asked on an online forum.
The problem is that since you’ve said the data you’re point to is
const, you can’t change it. You can’t initialize it, you can’t modify it, you can’tfreeit. So don’t use aconstpointer as your only pointer to the result of amalloc.