avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] memcpy() : problem when passing destination pointer


From: Graham Davies
Subject: Re: [avr-gcc-list] memcpy() : problem when passing destination pointer
Date: Tue, 10 Feb 2009 04:32:36 -0500

Vincent Trouilliez wrote:
... get a warning about the destination pointer:
... passing argument 1 of ‘memcpy’ discards qualifiers from pointer target type

Well, this is a pretty clear warning. Look at what you're passing to memcopy as argument 1 and then look for any type qualifiers in its declaration. Ahah! "volatile". Does formal argument 1 of memcpy have the volatile qualifier? No. Therefore, you're discarding it from the actual argument. That is, inside memcpy, the variable is no longer being treated as volatile. How you fix this depends on whether you care or not. If you need to preserve the volatile treatment, you'll have to write a replacement for memcpy. If you can let it go, just use an explicit cast.

Graham.







reply via email to

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